Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Weird exit caused in a trap DEBUG which sources a file.
- X-seq: zsh-workers 25377
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Weird exit caused in a trap DEBUG which sources a file.
- Date: Sun, 3 Aug 2008 11:42:15 +0100
- In-reply-to: <6cd6de210808020421k78d716a0mc995862eb761ea2@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <6cd6de210807301938m28e05c84vf6296aa5b1bc0d44@xxxxxxxxxxxxxx> <200807310901.m6V91g8T002478@xxxxxxxxxxxxxx> <6cd6de210807310305q5954b65ax405f51e54d6754ee@xxxxxxxxxxxxxx> <6cd6de210808010529h11898619kba301fddf8b72f00@xxxxxxxxxxxxxx> <20080801143747.19b65086@news01> <6cd6de210808010821g3117fe62y82bd580811dbba8a@xxxxxxxxxxxxxx> <200808011531.m71FVIFl028545@xxxxxxxxxxxxxx> <6cd6de210808020421k78d716a0mc995862eb761ea2@xxxxxxxxxxxxxx>
On Sat, 2 Aug 2008 07:21:43 -0400
"Rocky Bernstein" <rocky.bernstein@xxxxxxxxx> wrote:
>
> It may be useful to have some "trap DEBUG" exit codes alter program
> flow. For example in bash if "trap DEBUG" returns 2, then if you are
> inside a function that does an immediate return from the function
> (implementing a gdb "return" command).
This happens on any explicit "return" from a non-function trap.
> It might also be nice to have a "trap DEBUG" exit value which
> indicates that the next command is skipped rather than executed.
That's a little more tricky: it's not very clear what the next command
actually is if it's a complicated expression. Looking at the code, it's
not hard to do something here, but making it properly consistent is
another matter. I think it would probably work if done at the level of
commands separated by semicolons, newlines or ampersands (described
internally as sublists).
> And since I brought up "trap DEBUG" execution order again, at the risk
> of beating a dead horse...
I don't really understand what the issue is. Is there something about
the DEBUG_BEFORE_CMD option that makes it hard to ensure it is set at
the right point (this is not a trick question, that's perfectly
possible)?
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author