prevent git from prompting user if program is run directly

This commit is contained in:
Jesse Duffield
2021-04-06 19:34:32 +10:00
parent 8e9d08bc10
commit c33f8d2790
+3
View File
@@ -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())
}