diff --git a/pkg/cmd/proc/reaper/wait.go b/pkg/cmd/proc/reaper/wait.go index dfc4e67..18d139b 100644 --- a/pkg/cmd/proc/reaper/wait.go +++ b/pkg/cmd/proc/reaper/wait.go @@ -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