Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
EXIT trap executes too late?
- X-seq: zsh-workers 17271
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: EXIT trap executes too late?
- Date: Sun, 2 Jun 2002 16:08:20 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
"The functions beginning `TRAP' may alternatively be defined with the
trap builtin: this may be preferable for some uses, as they are then
run in the environment of the calling process, rather than in their own
function environment."
That doesn't appear to be true for the EXIT trap:
schaefer<502> function showtrap () {
function> setopt localoptions localtraps
function> x='Global value of $x'
function> local x='Local value of $x'
function> trap 'print $x' EXIT INT
function> sleep 5
function> }
schaefer<503> showtrap
<hit C-c>
Local value of $x
Global value of $x
schaefer<504> showtrap
<wait 5 seconds>
Global value of $x
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author