Skip to content

Commit

Permalink
exec: Exit with exit code of subcommand
Browse files Browse the repository at this point in the history
Code was already there but the order of if blocks made this block
unreachable.
  • Loading branch information
hraban committed Dec 28, 2016
1 parent 658b48f commit 0fadd92
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ func ExecCommand(app *kingpin.Application, input ExecCommandInput) {

var waitStatus syscall.WaitStatus
if err := cmd.Run(); err != nil {
if err != nil {
app.Errorf("%v", err)
return
}
if exitError, ok := err.(*exec.ExitError); ok {
waitStatus = exitError.Sys().(syscall.WaitStatus)
os.Exit(waitStatus.ExitStatus())
}
if err != nil {
app.Errorf("%v", err)
return
}
}
}

Expand Down

0 comments on commit 0fadd92

Please sign in to comment.