summaryrefslogtreecommitdiffstats
path: root/pkg/commands/os.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2019-02-18 23:27:54 +1100
committerJesse Duffield <jessedduffield@gmail.com>2019-02-18 23:27:54 +1100
commitd44638130c8d07c648b45796cc6b0dff221c7d82 (patch)
tree71b1bfdc271de1cac8fffe223d23fe7295c0158d /pkg/commands/os.go
parent76a27f417fc7fd24b4fdf12f0aeeb94ecca958d3 (diff)
add various interactive rebase commands
Diffstat (limited to 'pkg/commands/os.go')
-rw-r--r--pkg/commands/os.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/commands/os.go b/pkg/commands/os.go
index c404f4de1..e5ae0a041 100644
--- a/pkg/commands/os.go
+++ b/pkg/commands/os.go
@@ -247,3 +247,19 @@ func (c *OSCommand) FileExists(path string) (bool, error) {
}
return true, nil
}
+
+// RunPreparedCommand takes a pointer to an exec.Cmd and runs it
+// this is useful if you need to give your command some environment variables
+// before running it
+func (c *OSCommand) RunPreparedCommand(cmd *exec.Cmd) error {
+ out, err := cmd.CombinedOutput()
+ outString := string(out)
+ c.Log.Info(outString)
+ if err != nil {
+ if len(outString) == 0 {
+ return err
+ }
+ return errors.New(outString)
+ }
+ return nil
+}