On Wed, Mar 22, 2017 at 10:43:18PM -0700, Junio C Hamano wrote:

> -             test_eval_ "(exit 117) && $1"
> -             if test "$?" != 117; then
> -                     error "bug in the test script: broken &&-chain: $1"
> +             if test "OK-117" != "$(test_eval_ "(exit 117) && 
> $1${LF}${LF}echo OK-\$?" 3>&1)"
> +             then
> +                     error "bug in the test script: broken &&-chain or 
> run-away HERE-DOC: $1"

This looks good. I had pondered how we might do this but was worried
that it would have to end up actually executing the test contents. But
this leverages the fact that the problem is syntactic and that the shell
will parse the complete &&-chain before executing any of it. Clever.

-Peff

Reply via email to