summaryrefslogtreecommitdiffstats
path: root/pkg/commands/oscommands
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-04-05 20:39:47 +1000
committerJesse Duffield <jessedduffield@gmail.com>2021-04-06 19:34:32 +1000
commitc33f8d2790e757492a027568285568f5ebc505b1 (patch)
treec6c2b70c329678418fc4f9f0b9e7711e22cc7cb8 /pkg/commands/oscommands
parent8e9d08bc10f206fae889f4529931e3e7277860c7 (diff)
prevent git from prompting user if program is run directly
Diffstat (limited to 'pkg/commands/oscommands')
-rw-r--r--pkg/commands/oscommands/os.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/commands/oscommands/os.go b/pkg/commands/oscommands/os.go
index bd1102d22..af5b97ca4 100644
--- a/pkg/commands/oscommands/os.go
+++ b/pkg/commands/oscommands/os.go
@@ -71,7 +71,10 @@ type RunCommandOptions struct {
func (c *OSCommand) RunCommandWithOutputWithOptions(command string, options RunCommandOptions) (string, error) {
c.Log.WithField("command", command).Info("RunCommand")
cmd := c.ExecutableFromString(command)
+
+ cmd.Env = append(cmd.Env, "GIT_TERMINAL_PROMPT=0") // prevents git from prompting us for input which would freeze the program
cmd.Env = append(cmd.Env, options.EnvVars...)
+
return sanitisedCommandOutput(cmd.CombinedOutput())
}