fix(mage): handle different types of errors
This commit is contained in:
parent
51cd2830dd
commit
8f473481ac
1 changed files with 4 additions and 2 deletions
|
@ -79,9 +79,11 @@ func runCmdWithOutput(name string, arg ...string) (output []byte, err error) {
|
|||
cmd := exec.Command(name, arg...)
|
||||
output, err = cmd.Output()
|
||||
if err != nil {
|
||||
ee := err.(*exec.ExitError)
|
||||
if ee, is := err.(*exec.ExitError); is {
|
||||
return nil, fmt.Errorf("error running command: %s, %s", string(ee.Stderr), err)
|
||||
}
|
||||
return nil, fmt.Errorf("error running command: %s", err)
|
||||
}
|
||||
|
||||
return output, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue