Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: trap does not work in a trap function?



> > > Why is the shutdown function called again by exit when the EXIT
> > > trap was just removed?  This looks like the trap builtin does not
> > > properly work from within a trap handler.
> 
> The EXIT trap you removed was the one for the "shutdown" function.  In
> zsh,
> EXIT is used with functions as well as scripts.
> 
> You can do what you want like this:
> 
> shutdown () {
>   echo shutdown
>   trap 'trap - EXIT' EXIT
>   exit 77
> }
> 
> unless shutdown is itself called from within a function, in which case
> you're removing the EXIT trap for that.

Understood.  But then, what is the localtraps option good
for?  I thought it was meant to do exactly what you describe
above.

Ciao

Dominik ^_^  ^_^
-- 
GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 fÃr nur 19,99 Euro/mtl.!*
http://portal.gmx.net/de/go/dsl



Messages sorted by: Reverse Date, Date, Thread, Author