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

Re: PATCH: skip command from debug trap



On Tue, Aug 05, 2008 at 03:27:18PM +0100, Peter Stephenson wrote:
> I believe this is the fairly simple code needed to skip a command from a
> debug trap.
> 
> The only difficult bit is the way of triggering it, since it's long
> established that any non-zero number returned from a trap causes the
> enclosing function to return.  I was inclined to pick a negative number,
> but Rocky wants that for something else.  So how about 255, which is
> fairly special?
[...]

How about a special variable containing the code to be run
available from the trap and that can be set to something else
within the trap.

Or how about using some form of exception raising?

Also, I don't know if it's been mentionned before, put to have a
DEBUG trap before every command, it seems that we should be able
to use PS4 with set -x, though there may not be any easy way
_not_ to start a subshell:

PS4='$(debug_function)'

-- 
Stéphane



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