From 8f473481ac52f012b702e53626f03e8c2dc17dac Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 3 Aug 2022 17:11:17 +0200 Subject: [PATCH] fix(mage): handle different types of errors --- magefile.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/magefile.go b/magefile.go index dfd12235..185ad0bd 100644 --- a/magefile.go +++ b/magefile.go @@ -79,8 +79,10 @@ 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) - return nil, fmt.Errorf("error running command: %s, %s", string(ee.Stderr), err) + 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