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

Re: Zsh does not follow POSIX when return is called during the action of a trap



On 3/12/14 1:03 PM, Peter Stephenson wrote:

> However, I'm trying to work out what happens with the case
> 
> |  trap '(exit BEFORE-RETURN); return EXPLICIT-RETURN-VALUE' SIGNAL
> |
> |  fn() {
> |    (exit BEFORE-ACTION); -block here waiting for signal-
> |  }
> 
> Should this exit with EXPLICIT-RETURN_VALUE or BEFORE-ACTION?  The
> latter is easier to implement but my guess (without ploughing through
> the standard) is EXPLICIT-RETURN-VALUE is right here.

The correct exit value is EXPLICIT-RETURN-VALUE.

The standards text that Eduardo quoted only applies to the case where
`return' is not given an argument.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@xxxxxxxx    http://cnswww.cns.cwru.edu/~chet/



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