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:
16
task_test.go
16
task_test.go
@@ -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`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user