diff --git a/interp/interp_test.go b/interp/interp_test.go index 8b5522d5..47807473 100644 --- a/interp/interp_test.go +++ b/interp/interp_test.go @@ -1921,6 +1921,14 @@ var runTests = []runTest{ "set -o pipefail; set -M 2>/dev/null | false", "exit status 1", }, + { + "set -o pipefail; false | :; echo next", + "next\n", + }, + { + "set -e -o pipefail; false | :; echo next", + "exit status 1", + }, { "set -f; >a.x; echo *.x;", "*.x\n", diff --git a/interp/runner.go b/interp/runner.go index 9acd804e..007f8776 100644 --- a/interp/runner.go +++ b/interp/runner.go @@ -459,6 +459,7 @@ func (r *Runner) cmd(ctx context.Context, cm syntax.Command) { wg.Wait() if r.opts[optPipeFail] && r2.exit != 0 && r.exit == 0 { r.exit = r2.exit + r.shellExited = r2.shellExited } r.setErr(r2.err) }