summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-09-01 13:27:58 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-09-01 13:27:58 +1000
commit865809e625330d672f428630d1faae2968b6b7b1 (patch)
tree4d5d3b0a027783261547be4633693d60e9898361 /pkg
parent04d5a473d758090b0f65af5520e91bc7924648a1 (diff)
better error handling for commands
Diffstat (limited to 'pkg')
-rw-r--r--pkg/commands/os.go5
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
}