zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <Peter.Stephenson@csr.com>
To: <zsh-workers@zsh.org>
Subject: Re: TRAPALRM / TMOUT oddity
Date: Thu, 26 May 2011 10:14:28 +0100	[thread overview]
Message-ID: <20110526101428.71e440e9@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <110525204737.ZM24434@torch.brasslantern.com>

On Wed, 25 May 2011 20:47:37 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> Consider:
> 
> % TRAPALRM() { print TIME IS UP; exit 1 }
> % TMOUT=5
> 
> You'd expect the shell to exit in 5 seconds, but instead what happens
> is that TIME IS UP is printed every 5 seconds until any key is
> pressed, at which point the shell exits.
> 
> The same behavior occurs when using "trap".

Index: Src/Zle/zle_main.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v
retrieving revision 1.127
diff -p -u -r1.127 zle_main.c
--- Src/Zle/zle_main.c	20 Dec 2010 10:28:43 -0000	1.127
+++ Src/Zle/zle_main.c	26 May 2011 09:12:43 -0000
@@ -633,7 +633,7 @@ raw_getbyte(long do_keytmout, char *cptr
 	    /*
 	     * Make sure a user interrupt gets passed on straight away.
 	     */
-	    if (selret < 0 && errflag)
+	    if (selret < 0 && (errflag || retflag || breaks || exit_pending))
 		break;
 	    /*
 	     * Try to avoid errors on our special fd's from
@@ -875,7 +875,7 @@ getbyte(long do_keytmout, int *timeout)
 	    icnt = 0;
 	    if (errno == EINTR) {
 		die = 0;
-		if (!errflag && !retflag && !breaks)
+		if (!errflag && !retflag && !breaks && !exit_pending)
 		    continue;
 		errflag = 0;
 		breaks = obreaks;

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


  reply	other threads:[~2011-05-26  9:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-26  3:47 Bart Schaefer
2011-05-26  9:14 ` Peter Stephenson [this message]
2011-05-27  1:11   ` Recent curses module changes and " Bart Schaefer
2011-05-27  8:46     ` Peter Stephenson

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=20110526101428.71e440e9@pwslap01u.europe.root.pri \
    --to=peter.stephenson@csr.com \
    --cc=zsh-workers@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).