diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-09-01 13:27:58 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-09-01 13:27:58 +1000 |
commit | 865809e625330d672f428630d1faae2968b6b7b1 (patch) | |
tree | 4d5d3b0a027783261547be4633693d60e9898361 /pkg | |
parent | 04d5a473d758090b0f65af5520e91bc7924648a1 (diff) |
better error handling for commands
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/commands/os.go | 5 |
1 files changed, 4 insertions, 1 deletions
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 } |