Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Trap bug?
- X-seq: zsh-workers 3679
- From: Bernd Eggink <eggink@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers mailing list <zsh-workers@xxxxxxxxxxxxxxx>
- Subject: Trap bug?
- Date: Fri, 09 Jan 1998 12:11:19 +0100
- Organization: RRZ Uni Hamburg
- Sender: rz2a022@xxxxxxxxxxxxxxxxxx
This doesn't work correctly in 3.1.2:
function f
{
( trap 'print "INT f"; return 0' INT
while true; do :; done
)
print "Leaving f"
}
f
print "Leaving script"
Hitting Ctrl-C during the loop in f causes an immediate exit from the
_script_, not just a return from the function, as it should (IMHO).
If the trap command is outside the parentheses, it works:
function f
{ trap 'print "INT f"; return 0' INT
(
while true; do :; done
)
print "Leaving f"
}
But then the traps won't be automatically restored before leaving the
function, which is what I intended.
Bernd
--
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
eggink@xxxxxxxxxxxxxxxxxx
http://www.rrz.uni-hamburg.de/eggink/BEggink.html
Messages sorted by:
Reverse Date,
Date,
Thread,
Author