Skip to content

Commit 2a5b21a

Browse files
committed
Should overwrite env variable if it already exists
1 parent d6b832b commit 2a5b21a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

GitVersionCore/Helpers/ProcessHelper.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static Process Start(ProcessStartInfo startInfo)
3636
startInfo.FileName,
3737
exception);
3838
}
39-
39+
4040
throw;
4141
}
4242
}
@@ -70,8 +70,14 @@ public static int Run(Action<string> output, Action<string> errorOutput, TextRea
7070
};
7171
foreach (var environmentalVariable in environmentalVariables)
7272
{
73-
if (!psi.EnvironmentVariables.ContainsKey(environmentalVariable.Key) && environmentalVariable.Value != null)
73+
if (psi.EnvironmentVariables.ContainsKey(environmentalVariable.Key))
74+
{
75+
psi.EnvironmentVariables[environmentalVariable.Key] = environmentalVariable.Value;
76+
}
77+
else
78+
{
7479
psi.EnvironmentVariables.Add(environmentalVariable.Key, environmentalVariable.Value);
80+
}
7581
if (psi.EnvironmentVariables.ContainsKey(environmentalVariable.Key) && environmentalVariable.Value == null)
7682
psi.EnvironmentVariables.Remove(environmentalVariable.Key);
7783
}

0 commit comments

Comments
 (0)