Skip to content

Commit 9637b6a

Browse files
committed
remove stop_on_error
1 parent ffb5780 commit 9637b6a

File tree

5 files changed

+6
-21
lines changed

5 files changed

+6
-21
lines changed

exec/model.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ type Context struct {
1818
Cmds []string
1919
Pids []int
2020
Shell string
21-
StopOnError bool
2221
}
2322

2423
func (c *Context) Copy() Context {

exec/runner.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ func (sr SystemRunner) Run(execContext *Context) error {
102102
return err
103103
}
104104
var exitCode int
105-
execContext.Pids, exitCode, err = sr.runCmds(cmds, execContext.StopOnError)
105+
execContext.Pids, exitCode, err = sr.runCmds(cmds)
106106
if err != nil {
107107
return RunError{Err: err, ExitCode: exitCode}
108108
}
109109

110110
return nil
111111
}
112112

113-
func (sr SystemRunner) runCmds(cmds []*exec.Cmd, stopOnError bool) (pids []int, exitCode int, err error) {
113+
func (sr SystemRunner) runCmds(cmds []*exec.Cmd) (pids []int, exitCode int, err error) {
114114
for _, cmd := range cmds {
115115
logrus.Debugf("will run cmd '%s'", cmd.String())
116116
err := sr.SystemAPI.Run(cmd)
@@ -119,16 +119,11 @@ func (sr SystemRunner) runCmds(cmds []*exec.Cmd, stopOnError bool) (pids []int,
119119
}
120120

121121
if exitError, ok := err.(*exec.ExitError); ok {
122-
if stopOnError {
123-
exitCode = exitError.ExitCode()
124-
} else {
125-
// Using stop_on_error: False, the overall exit code is the sum of all individual exit codes.
126-
exitCode += exitError.ExitCode()
127-
}
122+
exitCode = exitError.ExitCode()
128123
}
129124

130-
if stopOnError && err != nil {
131-
logrus.Debugf("stopped execution of multi-command (stop-on-error=%v)", stopOnError)
125+
if err != nil {
126+
logrus.Debugf("stopped execution of multi-command")
132127
return pids, exitCode, err
133128
}
134129
logrus.Debugf("execution success for '%s'", cmd.String())

exec/runner_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func TestRunner(t *testing.T) {
135135
execContext := tc.execContext
136136
err := systemRunner.Run(execContext)
137137
if tc.expectedErr != nil {
138-
assert.Equal(t, err, tc.expectedErr)
138+
assert.Equal(t, tc.expectedErr, err)
139139
return
140140
}
141141

tasks/cmdRunTask.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ type CmdRunTask struct {
3131

3232
// aborts task execution if one task fails
3333
AbortOnError bool
34-
35-
// aborts execution of a multi command task if a command fails
36-
StopOnError bool
3734
}
3835

3936
type CmdRunTaskBuilder struct {
@@ -86,8 +83,6 @@ func (crtb CmdRunTaskBuilder) Build(typeName, path string, ctx interface{}) (Tas
8683
errs.Add(err)
8784
case AbortOnErrorField:
8885
t.AbortOnError = conv.ConvertToBool(val)
89-
case StopOnErrorField:
90-
t.StopOnError = conv.ConvertToBool(val)
9186
}
9287
}
9388

@@ -148,7 +143,6 @@ func (crte *CmdRunTaskExecutor) Execute(ctx context.Context, task Task) Executio
148143
Envs: cmdRunTask.Envs,
149144
Cmds: cmdRunTask.GetNames(),
150145
Shell: cmdRunTask.Shell,
151-
StopOnError: cmdRunTask.StopOnError,
152146
}
153147

154148
shouldNotBeExecutedReason, err := crte.shouldBeExecuted(execCtx, cmdRunTask)
@@ -165,8 +159,6 @@ func (crte *CmdRunTaskExecutor) Execute(ctx context.Context, task Task) Executio
165159

166160
start := time.Now()
167161

168-
// XXXX respect stop_on_error
169-
170162
err = crte.Runner.Run(execCtx)
171163

172164
execRes.Duration = time.Since(start)

tasks/fields.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const (
2727
ModeField = "mode"
2828
EncodingField = "encoding"
2929
AbortOnErrorField = "abort_on_error"
30-
StopOnErrorField = "stop_on_error"
3130
Version = "version"
3231
Refresh = "refresh"
3332
)

0 commit comments

Comments
 (0)