3 ms·
Yeah this is a variation on problem 2 I mentioned here, except with subshells rather than functions. https://news.ycombinator.com/item?id=24740842 https://news
by chubot 6y ago
Yeah this is a variation on problem 2 I mentioned here, except with subshells rather than functions.
https://news.ycombinator.com/item?id=24740842 https://news.ycombinator.com/item?id=24740842
The problem actually has more to do with the definition of $? than the set -e behavior itself. And the fact that POSIX specifies that the error a the LHS of && is ignored (a fundamental confusion between true/false and success/error)
The exit code of the function is not what you expect, or the exit code of the subshell is not what you expect.
I made a note of it on the bug ... still thinking about what the solution to that one is.
(The other solutions are inherit_errexit, more_errexit, and a "catch" builtin.)