1
0
mirror of https://github.com/go-task/task.git synced 2025-11-23 22:24:45 +02:00

Run "set -e" automatically for every command

Without this, multiline command strings won't always exit when they fail.

Closes #403
This commit is contained in:
Andrey Nering
2020-12-27 17:15:12 -03:00
parent 16fad60833
commit ac8e344173
4 changed files with 42 additions and 0 deletions

View File

@@ -868,3 +868,19 @@ func TestDotenvShouldAllowMissingEnv(t *testing.T) {
}
tt.Run(t)
}
func TestExitImmediately(t *testing.T) {
const dir = "testdata/exit_immediately"
var buff bytes.Buffer
e := task.Executor{
Dir: dir,
Stdout: &buff,
Stderr: &buff,
Silent: true,
}
assert.NoError(t, e.Setup())
assert.Error(t, e.Run(context.Background(), taskfile.Call{Task: "default"}))
assert.Contains(t, buff.String(), `"this_should_fail": executable file not found in $PATH`)
}