Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: read still active after Ctrl-C
On Thu, 02 Jun 2016 08:19:56 +0200
Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> how to leave whole script on Ctrl-C? Below is a simple example where
> read is still active and waits for a key after Ctrl-C is pressed
There's a bug here, definitely. As it wasn't entirely clear to me what
the result of all those traps was going to be I actually tried it with a
simpler trap on SIGINT only.
That second catch-all attempt to read from the terminal if the first
attempt via select failed was always voodoo. I've a vague feeling it
was inspired by playing around on an old SunOS system a good twenty
years ago. I'm not sure if this particular cargo cult now needs to be
expunged.
pws
diff --git a/Src/utils.c b/Src/utils.c
index 12911d3..95be1fb 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2534,7 +2534,7 @@ read_poll(int fd, int *readchar, int polltty, zlong microseconds)
#endif
#endif
- if (fd >= 0 && ret < 0) {
+ if (fd >= 0 && ret < 0 && !errflag) {
/*
* Final attempt: set non-blocking read and try to read a character.
* Praise Bill, this works under Cygwin (nothing else seems to).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author