Skip to content

Commit d735250

Browse files
committed
fix: return an error on process nonzero exit code
This is how cmd.Wait does and what Talos needs for tests not to fail Signed-off-by: Dmitry Sharshakov <[email protected]>
1 parent 5662c7f commit d735250

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Diff for: pkg/cmd/proc/reaper/wait.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,16 @@ func WaitWrapper(usingReaper bool, notifyCh <-chan ProcessInfo, cmd *exec.Cmd) e
4444
// ProcessWaitWrapper(true, proc) should be equivalent to proc.Wait().
4545
func ProcessWaitWrapper(usingReaper bool, notifyCh <-chan ProcessInfo, proc *os.Process) error {
4646
if !usingReaper {
47-
_, waitErr := proc.Wait()
47+
state, err := proc.Wait()
48+
if err != nil {
49+
return err
50+
}
51+
52+
if !state.Success() {
53+
return &exec.ExitError{ProcessState: state}
54+
}
4855

49-
return waitErr
56+
return nil
5057
}
5158

5259
var info ProcessInfo

0 commit comments

Comments
 (0)