Skip to content

Commit

Permalink
🐛 fix nil panics in RunCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
shravanasati committed Jan 18, 2024
1 parent ce58898 commit 0613d9b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,19 @@ func RunCommand(runOpts *RunOptions) *RunResult {
init := time.Now()
if e = cmd.Start(); e != nil {
runResult.err = &failedProcessError{command: runOpts.command, err: e, where: "starting"}
return runResult
}
e = cmd.Wait()
duration := time.Since(init)

if e != nil {
if ctx.Err() == context.DeadlineExceeded {
runResult.err = &failedProcessError{command: runOpts.command, err: context.DeadlineExceeded, where: "execution"}
return runResult
}
if !runOpts.ignoreError {
runResult.err = &failedProcessError{command: runOpts.command, err: e, where: "execution"}
return runResult
}
}

Expand Down

0 comments on commit 0613d9b

Please sign in to comment.