Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: trap does not work in a trap function?
- X-seq: zsh-users 15380
- From: "Dominik Vogt" <dominik.vogt@xxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: trap does not work in a trap function?
- Date: Thu, 09 Sep 2010 14:03:41 +0200
- In-reply-to: <20100909095753.5473e833@xxxxxxxxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20100909080214.76320@xxxxxxx> <20100909081733.76300@xxxxxxx> <20100909095753.5473e833@xxxxxxxxxxxxxxxxxxxxxxxxx>
> > > 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