From c33f8d2790e757492a027568285568f5ebc505b1 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 5 Apr 2021 20:39:47 +1000 Subject: [PATCH] prevent git from prompting user if program is run directly --- pkg/commands/oscommands/os.go | 3 +++ 1 file changed, 3 insertions(+) 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()) }