diff --git a/src/Core/WinSWCore/Util/ProcessHelper.cs b/src/Core/WinSWCore/Util/ProcessHelper.cs index 3836afa..03327aa 100644 --- a/src/Core/WinSWCore/Util/ProcessHelper.cs +++ b/src/Core/WinSWCore/Util/ProcessHelper.cs @@ -147,15 +147,11 @@ namespace winsw.Util foreach (string key in envVars.Keys) { Environment.SetEnvironmentVariable(key, envVars[key]); - // ps.EnvironmentVariables[key] = envs[key]; // bugged (lower cases all variable names due to StringDictionary being used, see http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=326163) + // DONTDO: ps.EnvironmentVariables[key] = envs[key]; + // bugged (lower cases all variable names due to StringDictionary being used, see http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=326163) } } - //TODO: move outside, stubbed to reproduce the issue - // TODO: Make it generic via extension points. The issue mentioned above should be ideally worked around somehow - ps.EnvironmentVariables[WinSWSystem.ENVVAR_NAME_SERVICE_ID.ToLower()] = "myapp";// _descriptor.Id; - // Environment.SetEnvironmentVariable(WinSWSystem.ENVVAR_NAME_SERVICE_ID.ToLower(), _descriptor.Id); - processToStart.Start(); Logger.Info("Started process " + processToStart.Id); diff --git a/src/Plugins/RunawayProcessKiller/RunawayProcessKillerExtension.cs b/src/Plugins/RunawayProcessKiller/RunawayProcessKillerExtension.cs index 94abf59..66d7e0f 100644 --- a/src/Plugins/RunawayProcessKiller/RunawayProcessKillerExtension.cs +++ b/src/Plugins/RunawayProcessKiller/RunawayProcessKillerExtension.cs @@ -118,9 +118,10 @@ namespace winsw.Plugins.RunawayProcessKiller // TODO: This method is not ideal since it works only for vars explicitly mentioned in the start info // No Windows 10- compatible solution for EnvVars retrieval, see https://blog.gapotchenko.com/eazfuscator.net/reading-environment-variables StringDictionary previousProcessEnvVars = proc.StartInfo.EnvironmentVariables; - String expectedEnvVarName = WinSWSystem.ENVVAR_NAME_SERVICE_ID.ToLower(); + String expectedEnvVarName = WinSWSystem.ENVVAR_NAME_SERVICE_ID; if (previousProcessEnvVars.ContainsKey(expectedEnvVarName)) { + // StringDictionary is case-insensitive, hence it will fetch variable definitions in any case affiliatedServiceId = previousProcessEnvVars[expectedEnvVarName]; } else if (CheckWinSWEnvironmentVariable)