From 865809e625330d672f428630d1faae2968b6b7b1 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 1 Sep 2018 13:27:58 +1000 Subject: [PATCH] better error handling for commands --- pkg/commands/os.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/commands/os.go b/pkg/commands/os.go index 680105df8..9fc3a2bc0 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -90,6 +90,9 @@ func sanitisedCommandOutput(output []byte, err error) (string, error) { if err != nil { // errors like 'exit status 1' are not very useful so we'll create an error // from the combined output + if outputString == "" { + return "", err + } return outputString, errors.New(outputString) } return outputString, nil @@ -111,7 +114,7 @@ func (c *OSCommand) OpenFile(filename string) error { } command := utils.ResolvePlaceholderString(commandTemplate, templateValues) - err := c.RunCommand(command) + _, err := c.RunCommandWithOutput(command) return err }