Skip to content

Commit

Permalink
fix: step error detection
Browse files Browse the repository at this point in the history
  • Loading branch information
mohemohe committed Dec 18, 2023
1 parent 253636b commit 60b1e9d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/v1/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func (e *Executor) runJob(name string, job *Job) (result error) {
if isWindows {
job.Shell = "cmd.exe /c"
} else {
job.Shell = "/bin/sh"
job.Shell = "/bin/sh -e"
}
}

Expand All @@ -388,10 +388,16 @@ func (e *Executor) runJob(name string, job *Job) (result error) {
}
newStep.Env = append(newStep.Env, "LSCBUILD_CWD="+cwd)

e.runStep(job, &newStep)
result = e.runStep(job, &newStep)
if result != nil {
return result
}
}
} else {
e.runStep(job, &step)
result = e.runStep(job, &step)
if result != nil {
return result
}
}
}

Expand Down
7 changes: 7 additions & 0 deletions sample.lscbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,10 @@ jobs:
test9:
steps:
- use: common-creation/lscbuild-plugin-sample

test10:
steps:
- cmd: echo ok
- cmd: echo ok && exit 0
- cmd: echo error && exit 1
- cmd: echo not exec

0 comments on commit 60b1e9d

Please sign in to comment.