diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2021-12-15 16:41:35 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-20 20:02:06 +0300 |
commit | 69e9c5ebbf5100b56a7f85b4a49603f8f5bf33bd (patch) | |
tree | 8289cab918c1096cd6a5e844f438d8d4414c2e89 | |
parent | 2db02e932c25bb96b269a9ac7a93f5bf52869865 (diff) |
Override global environment variables with the ones set by a command
AllowedEnvironment currently overrides any variables set by the command.
In order to override some of the variables, one would have to globally set
an environment variable. Change the order of how the environment variables
are collected so the command invocation can override environment variables.
-rw-r--r-- | internal/command/command.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/command/command.go b/internal/command/command.go index b7417aa9b..9de34a5fb 100644 --- a/internal/command/command.go +++ b/internal/command/command.go @@ -173,7 +173,7 @@ func New(ctx context.Context, cmd *exec.Cmd, stdin io.Reader, stdout, stderr io. env = append(env, "GIT_TERMINAL_PROMPT=0") // Export env vars - cmd.Env = append(env, AllowedEnvironment(os.Environ())...) + cmd.Env = append(AllowedEnvironment(os.Environ()), env...) cmd.Env = envInjector(ctx, cmd.Env) // Start the command in its own process group (nice for signalling) |