bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Revisiting Error handling (errexit)


From: Lawrence Velázquez
Subject: Re: Revisiting Error handling (errexit)
Date: Mon, 04 Jul 2022 12:40:46 -0400
User-agent: Cyrus-JMAP/3.7.0-alpha0-713-g1f035dc716-fm-20220617.001-g1f035dc7

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

[Prev in Thread] Current Thread [Next in Thread]