mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
fixed multiple instances starting when updateing nzbdrone
This commit is contained in:
parent
4ee148549f
commit
091ec312c8
@ -18,7 +18,13 @@ public class ProcessProviderTests : TestBase<ProcessProvider>
|
||||
[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 @@ public void Should_be_able_to_start_process()
|
||||
{
|
||||
var startInfo = new ProcessStartInfo(Path.Combine(Directory.GetCurrentDirectory(), DummyApp.DUMMY_PROCCESS_NAME + ".exe"));
|
||||
|
||||
|
||||
Subject.Exists(DummyApp.DUMMY_PROCCESS_NAME).Should()
|
||||
.BeFalse("Dummy process is already running");
|
||||
Subject.Start(startInfo).Should().NotBeNull();
|
||||
var process = Subject.Start(startInfo);
|
||||
|
||||
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]
|
||||
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 @@ public Process ShellExecute(string path, string args = null, Action<string> onOu
|
||||
|
||||
process.BeginErrorReadLine();
|
||||
process.BeginOutputReadLine();
|
||||
process.Start();
|
||||
|
||||
return process;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user