better PID environment variable handling.

pull/3113/head
kay.one 13 years ago
parent ecbf127321
commit 571998e70e

@ -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>()

@ -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
{

Loading…
Cancel
Save