From 0fadd92e072ca5f09b57b7216a48e800777cb0ea Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Wed, 28 Dec 2016 15:05:36 +0000 Subject: [PATCH] exec: Exit with exit code of subcommand Code was already there but the order of if blocks made this block unreachable. --- exec.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exec.go b/exec.go index a8ad01d2e..08f0f0c27 100644 --- a/exec.go +++ b/exec.go @@ -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 + } } }