Skip to content

Commit

Permalink
fix: return an error on process nonzero exit code
Browse files Browse the repository at this point in the history
This is how cmd.Wait does and what Talos needs for tests not to fail

Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
  • Loading branch information
dsseng committed Oct 28, 2024
1 parent 5662c7f commit d735250
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/cmd/proc/reaper/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,16 @@ func WaitWrapper(usingReaper bool, notifyCh <-chan ProcessInfo, cmd *exec.Cmd) e
// ProcessWaitWrapper(true, proc) should be equivalent to proc.Wait().
func ProcessWaitWrapper(usingReaper bool, notifyCh <-chan ProcessInfo, proc *os.Process) error {
if !usingReaper {
_, waitErr := proc.Wait()
state, err := proc.Wait()
if err != nil {
return err
}

if !state.Success() {
return &exec.ExitError{ProcessState: state}
}

return waitErr
return nil
}

var info ProcessInfo
Expand Down

0 comments on commit d735250

Please sign in to comment.