1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-24 16:53:54 +00:00

better PID environment variable handling.

This commit is contained in:
kay.one 2011-11-13 20:22:53 -08:00
parent ecbf127321
commit 571998e70e
2 changed files with 4 additions and 10 deletions

View file

@ -16,13 +16,13 @@ namespace NzbDrone.App.Test
public class IISProviderFixture : TestBase
{
[Test]
public void should_not_set_env_varibles_twice()
public void should_update_pid_env_varibles()
{
WithTempAsAppPath();
var dummy = StartDummyProcess();
Environment.SetEnvironmentVariable(EnviromentProvider.NZBDRONE_PID, "Test");
Environment.SetEnvironmentVariable(EnviromentProvider.NZBDRONE_PID, "0");
Environment.SetEnvironmentVariable(EnviromentProvider.NZBDRONE_PATH, "Test");
Mocker.GetMock<ProcessProvider>()

View file

@ -53,15 +53,9 @@ namespace NzbDrone.Providers
startInfo.RedirectStandardError = true;
startInfo.CreateNoWindow = true;
if (!startInfo.EnvironmentVariables.ContainsKey(EnviromentProvider.NZBDRONE_PATH))
{
startInfo.EnvironmentVariables.Add(EnviromentProvider.NZBDRONE_PATH, _enviromentProvider.ApplicationPath);
}
if (!startInfo.EnvironmentVariables.ContainsKey(EnviromentProvider.NZBDRONE_PID))
{
startInfo.EnvironmentVariables.Add(EnviromentProvider.NZBDRONE_PID, Process.GetCurrentProcess().Id.ToString());
}
startInfo.EnvironmentVariables[EnviromentProvider.NZBDRONE_PATH] = _enviromentProvider.ApplicationPath;
startInfo.EnvironmentVariables[EnviromentProvider.NZBDRONE_PID] = Process.GetCurrentProcess().Id.ToString();
try
{