Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: A05 Test Hang



On Jan 26, 10:09am, Peter Stephenson wrote:
}
} I'm still scratching my head over how it hung permanently,

When polltty() is true, we call gettyinfo() and settyinfo() even if
the file descriptor has nothing to do with a tty.  The settyinfo()
triggers a SIGTTOU which stops the whole process group.

} but it must be something to do with using terminal input mode
} when we shouldn't be.  So I suppose that's not particularly
} suspicious beyond the bug,but I can't quite convince myself...

Comments in read_poll() seem to indicate that polltty is only needed
as some kind of workaround for Cygwin.  It could probably be combined
with an isatty() test, or possibly even replaced by one.

(Indentation was 5 spaces instead of 4 for those two lines, emacs
fixed it for me.)

diff --git a/Src/utils.c b/Src/utils.c
index d38babb..47d9944 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2300,8 +2300,8 @@ read_poll(int fd, int *readchar, int polltty, zlong microseconds)
     struct ttyinfo ti;
 #endif
 
-     if (fd < 0)
-	 polltty = 0;		/* no tty to poll */
+    if (fd < 0 || (polltty && !isatty(fd)))
+	polltty = 0;		/* no tty to poll */
 
 #if defined(HAS_TIO) && !defined(__CYGWIN__)
     /*



Messages sorted by: Reverse Date, Date, Thread, Author