Skip to content

Commit 119a6fb

Browse files
committed
remove stop_on_error
1 parent 785c020 commit 119a6fb

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
@@ -32,9 +32,6 @@ type CmdRunTask struct {
3232

3333
// aborts task execution if one task fails
3434
AbortOnError bool
35-
36-
// aborts execution of a multi command task if a command fails
37-
StopOnError bool
3835
}
3936

4037
type CmdRunTaskBuilder struct {
@@ -87,8 +84,6 @@ func (crtb CmdRunTaskBuilder) Build(typeName, path string, ctx interface{}) (Tas
8784
errs.Add(err)
8885
case AbortOnErrorField:
8986
t.AbortOnError = conv.ConvertToBool(val)
90-
case StopOnErrorField:
91-
t.StopOnError = conv.ConvertToBool(val)
9287
}
9388
}
9489

@@ -150,7 +145,6 @@ func (crte *CmdRunTaskExecutor) Execute(ctx context.Context, task Task) Executio
150145
Envs: cmdRunTask.Envs,
151146
Cmds: cmdRunTask.GetNames(),
152147
Shell: cmdRunTask.Shell,
153-
StopOnError: cmdRunTask.StopOnError,
154148
}
155149

156150
shouldNotBeExecutedReason, err := crte.shouldBeExecuted(execCtx, cmdRunTask)
@@ -168,8 +162,6 @@ func (crte *CmdRunTaskExecutor) Execute(ctx context.Context, task Task) Executio
168162

169163
start := time.Now()
170164

171-
// XXXX respect stop_on_error
172-
173165
err = crte.Runner.Run(execCtx)
174166

175167
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)