mirror of
https://github.com/Radarr/Radarr
synced 2025-03-03 18:36:41 +00:00
added folder logging to isproduction test. better process name detection in mono.
This commit is contained in:
parent
873134fcee
commit
661ba97215
2 changed files with 14 additions and 3 deletions
|
@ -29,7 +29,7 @@ public void ApplicationPath_should_not_be_empty()
|
||||||
[Test]
|
[Test]
|
||||||
public void IsProduction_should_return_false_when_run_within_nunit()
|
public void IsProduction_should_return_false_when_run_within_nunit()
|
||||||
{
|
{
|
||||||
RuntimeInfo.IsProduction.Should().BeFalse("Process name is " + Process.GetCurrentProcess().ProcessName);
|
RuntimeInfo.IsProduction.Should().BeFalse("Process name is " + Process.GetCurrentProcess().ProcessName + " Folder is " + Directory.GetCurrentDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -27,7 +27,7 @@ public interface IProcessProvider
|
||||||
|
|
||||||
public class ProcessProvider : IProcessProvider
|
public class ProcessProvider : IProcessProvider
|
||||||
{
|
{
|
||||||
private static readonly Logger Logger = NzbDroneLogger.GetLogger();
|
private static readonly Logger Logger = NzbDroneLogger.GetLogger();
|
||||||
|
|
||||||
public const string NZB_DRONE_PROCESS_NAME = "NzbDrone";
|
public const string NZB_DRONE_PROCESS_NAME = "NzbDrone";
|
||||||
public const string NZB_DRONE_CONSOLE_PROCESS_NAME = "NzbDrone.Console";
|
public const string NZB_DRONE_CONSOLE_PROCESS_NAME = "NzbDrone.Console";
|
||||||
|
@ -213,7 +213,7 @@ private static ProcessInfo ConvertToProcessInfo(Process process)
|
||||||
return new ProcessInfo
|
return new ProcessInfo
|
||||||
{
|
{
|
||||||
Id = process.Id,
|
Id = process.Id,
|
||||||
StartPath = process.MainModule.FileName,
|
StartPath = GetExeFileName(process),
|
||||||
Name = process.ProcessName
|
Name = process.ProcessName
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -225,6 +225,17 @@ private static ProcessInfo ConvertToProcessInfo(Process process)
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static string GetExeFileName(Process process)
|
||||||
|
{
|
||||||
|
if (process.MainModule.FileName != "mono.exe")
|
||||||
|
{
|
||||||
|
return process.MainModule.FileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return process.Modules.Cast<ProcessModule>().FirstOrDefault(module => module.ModuleName.ToLower().EndsWith(".exe")).FileName;
|
||||||
|
}
|
||||||
|
|
||||||
private void Kill(int processId)
|
private void Kill(int processId)
|
||||||
{
|
{
|
||||||
var process = Process.GetProcesses().FirstOrDefault(p => p.Id == processId);
|
var process = Process.GetProcesses().FirstOrDefault(p => p.Id == processId);
|
||||||
|
|
Loading…
Reference in a new issue