On Mon, Jul 4, 2022, at 8:20 AM, Yair Lenga wrote:
> I was able to change Bash source and build a version that supports the new
> option 'errfail' (following the 'pipefail' naming), which will do the
> "right" thing in many cases - including the above - 'foo' will return 1,
> and will NOT proceed to action2. The implementation changes the processing
> of command-list ( '{ action1 ; action2 ; ... }') to break of the list, if
> any command returns a non-zero code, that is
>
> set -oerrfail
> { echo BEFORE ; false ; echo AFTER ; }
>
> Will print 'BEFORE', and return 1 (false), when executed under 'errfail'

This is already how errexit behaves in most contexts.

    % bash -ec '{ echo BEFORE; false; echo AFTER; }'; echo "$?"
    BEFORE
    1

So what did you actually change?  Presumably you tweaked the special
treatment given to the conditional portion of "if" commands, but
we shouldn't have to guess.

> I'm looking for feedback on this implementation. Will be happy to share the
> code if there is a chance that this will be accepted into the bash core
> code

I don't think there's a chance unless you share the code first.
Your description is wholly inadequate for understanding the true
nature of your proposal.

-- 
vq

Reply via email to