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

Re: PATCH: Re: Odd trap return status

Bart Schaefer wrote:
> Right, but
> 	foo () {
> 	 trap 'false' DEBUG
> 	 true
> 	}
> should not cause the exit status of foo to be nonzero.

This is already handled specially.  I think the code was sort of working
before execsave()/execrestore() got introduced for safety rather than
for logic.

	if (sigtrapped[SIGDEBUG]) {
	    exiting = donetrap;
	    ret = lastval;
	    lastval = ret;
	    donetrap = exiting;
	    noerrexit = oldnoerrexit;

> Installing a debug
> trap shouldn't change the behavior of the debugged code unless it *also*
> (intentionally) changes the command flow.

That's going to be kind of tricky with the code quoted above, which I
missed before.  But I don't feel like digging an even deeper hole.

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 392070

The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
If you received this in error, please contact the sender and 
delete the material from any computer.

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