Updated NzbDroneRunner

This commit is contained in:
kay.one
2013-08-13 20:22:28 -07:00
parent 6ef19ecc2d
commit 4a41ce7f29
5 changed files with 97 additions and 100 deletions

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
@@ -91,6 +90,7 @@ namespace NzbDrone.Common
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
RedirectStandardInput = true
};
@@ -125,9 +125,12 @@ namespace NzbDrone.Common
}
};
process.Start();
process.BeginErrorReadLine();
process.BeginOutputReadLine();
return process;
}
@@ -204,13 +207,15 @@ namespace NzbDrone.Common
private void Kill(int processId)
{
if (processId == 0 || Process.GetProcesses().All(p => p.Id != processId))
var process = Process.GetProcesses().FirstOrDefault(p => p.Id == processId);
if (process == null)
{
Logger.Warn("Cannot find process with id: {0}", processId);
return;
}
var process = Process.GetProcessById(processId);
process.Refresh();
if (process.HasExited)
{