mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-01-25 11:13:39 +02:00
better PID environment variable handling.
This commit is contained in:
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…
x
Reference in New Issue
Block a user