fixed multiple instances starting when updateing nzbdrone

pull/3113/head
kay.one 11 years ago
parent 4ee148549f
commit 091ec312c8

@ -18,7 +18,13 @@ namespace NzbDrone.Common.Test
[SetUp]
public void Setup()
{
Process.GetProcessesByName(DummyApp.DUMMY_PROCCESS_NAME).ToList().ForEach(c => c.Kill());
Process.GetProcessesByName(DummyApp.DUMMY_PROCCESS_NAME).ToList().ForEach(c =>
{
c.Kill();
c.WaitForExit();
});
Process.GetProcessesByName(DummyApp.DUMMY_PROCCESS_NAME).Should().BeEmpty();
}
[TearDown]
@ -51,13 +57,32 @@ namespace NzbDrone.Common.Test
{
var startInfo = new ProcessStartInfo(Path.Combine(Directory.GetCurrentDirectory(), DummyApp.DUMMY_PROCCESS_NAME + ".exe"));
var process = Subject.Start(startInfo);
Subject.Exists(DummyApp.DUMMY_PROCCESS_NAME).Should()
.BeFalse("Dummy process is already running");
Subject.Start(startInfo).Should().NotBeNull();
.BeTrue("excepted one dummy process to be already running");
process.Kill();
process.WaitForExit();
Subject.Exists(DummyApp.DUMMY_PROCCESS_NAME).Should().BeFalse();
}
[Test]
public void Should_be_able_to_execute_process()
{
var process = Subject.ShellExecute(Path.Combine(Directory.GetCurrentDirectory(), DummyApp.DUMMY_PROCCESS_NAME + ".exe"));
Subject.Exists(DummyApp.DUMMY_PROCCESS_NAME).Should()
.BeTrue("excepted one dummy process to be already running");
process.Kill();
process.WaitForExit();
Subject.Exists(DummyApp.DUMMY_PROCCESS_NAME).Should().BeFalse();
}
[Test]

@ -124,7 +124,6 @@ namespace NzbDrone.Common
process.BeginErrorReadLine();
process.BeginOutputReadLine();
process.Start();
return process;
}

Loading…
Cancel
Save