Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ERR__EXIT failure (was Re: zsh 5.2-test-1)
On 2016-12-05 13:11:30 +0100, Vincent Lefevre wrote:
> On 2016-12-05 11:30:29 +0000, Peter Stephenson wrote:
> > And plus also free bonus with same fix on { ... } --- see tests. But it
> > occurs to me perhaps it's not that simple...
> >
> > What about ( ... )? We can't check what's going on inside, so
> > presumably exiting on any non-zero status from that must be right?
>
> If you mean:
>
> set -e; ( false && true; ); echo OK
>
> then yes. A good idea is to compare with what the other shells do.
> dash, bash, ksh93 and mksh all exit in this case.
And this is really what the user should expect, IMHO. I mean that
from the current shell, the ( ... ) construct should be seen as a
black box, just like when running an external command. Hence this
behavior.
> > If so, is it really right to suppress exit on the status at the end
> > of { ... } or should the two work the same way?
>
> Concerning
>
> set -e; { false && true; }; echo OK
>
> dash, bash, ksh93 and mksh all print OK.
And on the opposite, { ... } is mainly used for grouping, but should
have as little effect as possible.
More precisely, on
set -e; { false && true; }; echo $?
the above shells output 1 as expected.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author