diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2008-11-11 18:25:44 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2008-11-11 18:25:44 +0000 |
commit | a1958f3c41d4c135173f282a99b9fbe1d0150fad (patch) | |
tree | f417f52e7c5bd9158dae4bfaf8fb45e11748e269 /Src/Zle | |
parent | 0e8d56723a6d695104c62793e11a15fdb59949b6 (diff) | |
download | zsh-a1958f3c41d4c135173f282a99b9fbe1d0150fad.tar.gz zsh-a1958f3c41d4c135173f282a99b9fbe1d0150fad.tar.xz zsh-a1958f3c41d4c135173f282a99b9fbe1d0150fad.zip |
26025: prefer handling user input to zle -F file descriptor
Diffstat (limited to 'Src/Zle')
-rw-r--r-- | Src/Zle/zle_main.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index 093160808..76bf44cbd 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -585,7 +585,7 @@ raw_getbyte(long do_keytmout, char *cptr) fds[i+1].events = POLLIN; } # endif - do { + for (;;) { # ifdef HAVE_POLL int poll_timeout; @@ -694,6 +694,19 @@ raw_getbyte(long do_keytmout, char *cptr) /* If error or unhandled timeout, give up. */ if (selret < 0) break; + /* + * If there's user input handle it straight away. + * This improves the user's ability to handle exceptional + * conditions like runaway output. + */ + if ( +# ifdef HAVE_POLL + (fds[0].revents & POLLIN) +# else + FD_ISSET(SHTTY, &foofd) +# endif + ) + break; if (nwatch && !errtry) { /* * Copy the details of the watch fds in case the @@ -755,13 +768,7 @@ raw_getbyte(long do_keytmout, char *cptr) zfree(lwatch_fds, lnwatch*sizeof(int)); freearray(lwatch_funcs); } - } while (! -# ifdef HAVE_POLL - (fds[0].revents & POLLIN) -# else - FD_ISSET(SHTTY, &foofd) -# endif - ); + } # ifdef HAVE_POLL zfree(fds, sizeof(struct pollfd) * nfds); # endif |