From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: read still active after Ctrl-C
Date: Thu, 02 Jun 2016 10:32:20 +0100 [thread overview]
Message-ID: <20160602103220.22e3447d@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CAKc7PVCGKYg2G3qRQ3d10shaPyQcrUbnV-BUm-RcOhHv2yM_RA@mail.gmail.com>
On Thu, 02 Jun 2016 08:19:56 +0200
Sebastian Gniazdowski <sgniazdowski@gmail.com> 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).
prev parent reply other threads:[~2016-06-02 9:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-02 6:19 Sebastian Gniazdowski
2016-06-02 9:32 ` Peter Stephenson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160602103220.22e3447d@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).