Zsh Mailing List Archive
Messages sorted by:
Re: Exception handling and "trap" vs. TRAPNAL()
- X-seq: zsh-workers 21795
- From: DervishD <zsh@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Exception handling and "trap" vs. TRAPNAL()
- Date: Sat, 1 Oct 2005 22:28:56 +0200
- Cc: Peter Stephenson <pws@xxxxxxx>, zsh-workers@xxxxxxxxxx
- In-reply-to: <1051001183818.ZM27904@xxxxxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Peter Stephenson <pws@xxxxxxx>, zsh-workers@xxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: DervishD
- References: <20050929200741.GA1156@DervishD> <20050930124130.45eb0463.pws@xxxxxxx> <20051001153756.GA12183@DervishD> <1051001183818.ZM27904@xxxxxxxxxxxxxxxxxxxxxxx>
Hi Bart :)
* Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> dixit:
> On Oct 1, 5:37pm, DervishD wrote:
> } Subject: Re: Exception handling and "trap" vs. TRAPNAL()
> } Hi Peter :)
> } * Peter Stephenson <pws@xxxxxxx> dixit:
> } > Add some "print"s to the trap to see when it's triggering.
> } The trap is triggering just in the "false" statement, and the
> } TRAPZERR works perfectly, it's the "trap" kind which is failing.
> I ran this with "set -x" (much better than inserting print statements)
I did exactly the same, and the "trap" didn't caused the always
block to run but the TRAPZERR bit did.
> } Can I do anything to make it work (except patching zsh)?
> I don't think so.
Well, then I'll use explicit throw commands instead of ZERR. The
code will be a bit messier but I'll try to use TRAPZERR whenever
possible until the ¿bug? is fixed. I am still not sure whether this
is a bug or a feature:
trap 'false' DEBUG
[[ $? -eq 1 ]] && print "What?"
This snippet doesn't print anything, and won't do even if using
TRAPDEBUG and "return 1" instead of "false". So ignoring errors from
inline traps make those traps and the TRAPNAL ones semantically
identical (TRAPNAL is a function, but its return value seems to be
ignored). Apart from this, I cannot think of a reason :?
Raúl Núñez de Arenas Coronado
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...
Messages sorted by: