Skip to content

Commit

Permalink
Merge pull request cake-build#1327 from devlead/feature/GH1326
Browse files Browse the repository at this point in the history
WIP GH1326: Address ProcessStartInfo envvar case sensitivite issue
  • Loading branch information
gep13 authored Oct 28, 2016
2 parents fa77bca + d5df48b commit 2db6f06
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Cake.Core/Polyfill/ProcessHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Diagnostics;
using System;
using System.Diagnostics;
using System.Linq;

namespace Cake.Core.Polyfill
{
Expand All @@ -7,8 +9,10 @@ internal static class ProcessHelper
public static void SetEnvironmentVariable(ProcessStartInfo info, string key, string value)
{
#if NETCORE
info.Environment[key] = value;
var envKey = info.Environment.Keys.FirstOrDefault(exisitingKey => StringComparer.OrdinalIgnoreCase.Equals(exisitingKey, key)) ?? key;
info.Environment[envKey] = value;
#else
var envKey = info.EnvironmentVariables.Keys.Cast<string>().FirstOrDefault(existingKey => StringComparer.OrdinalIgnoreCase.Equals(existingKey, key)) ?? key;
info.EnvironmentVariables[key] = value;
#endif
}
Expand Down

0 comments on commit 2db6f06

Please sign in to comment.