Thread (1 message) 1 message, 1 author, 2020-01-07

Re: [RFC PATCH] bisect run: allow inverting meaning of exit code

From: Junio C Hamano <hidden>
Date: 2020-01-07 01:43:07

Stephen Oberholtzer [off-list ref] writes:
... a clean, portable way to create a single case statement that
handles the final condition.
Hmm, don't we want to say (1) original 0 (success) maps to 1 (2)
original 125 maps to 125 (3) anything below 128 in the original maps
to 0 and (4) everything else is left intact?  Perhaps something as
simple like this, taking advantage of the fact that $? won't have
anything other than digits?

    ... do something ...
    status=$?

    case $status in
    0) status=1 ;;
    125) : as-is ;;
    ? | ?? | 1[01]? | 12[0-7]) status=0;;
    *) : as-is ;;
    esac

I am still unclear where the need for {SUCCESS_FAIL}_TERM magic
comes from, though.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help