Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: TRAPALRM / TMOUT oddity
On Wed, 25 May 2011 20:47:37 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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@xxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author