mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
GetCurrentProcessId for PidFileProvider
This commit is contained in:
parent
aa4fca7177
commit
6fd7a64330
@ -33,7 +33,7 @@ public void Write()
|
|||||||
var filename = Path.Combine(_appFolderInfo.AppDataFolder, "nzbdrone.pid");
|
var filename = Path.Combine(_appFolderInfo.AppDataFolder, "nzbdrone.pid");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.WriteAllText(filename, _processProvider.GetCurrentProcess().Id.ToString());
|
File.WriteAllText(filename, _processProvider.GetCurrentProcessId().ToString());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@ namespace NzbDrone.Common.Processes
|
|||||||
{
|
{
|
||||||
public interface IProcessProvider
|
public interface IProcessProvider
|
||||||
{
|
{
|
||||||
|
int GetCurrentProcessId();
|
||||||
ProcessInfo GetCurrentProcess();
|
ProcessInfo GetCurrentProcess();
|
||||||
ProcessInfo GetProcessById(int id);
|
ProcessInfo GetProcessById(int id);
|
||||||
List<ProcessInfo> FindProcessByName(string name);
|
List<ProcessInfo> FindProcessByName(string name);
|
||||||
@ -40,6 +41,11 @@ public ProcessProvider(Logger logger)
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetCurrentProcessId()
|
||||||
|
{
|
||||||
|
return Process.GetCurrentProcess().Id;
|
||||||
|
}
|
||||||
|
|
||||||
public ProcessInfo GetCurrentProcess()
|
public ProcessInfo GetCurrentProcess()
|
||||||
{
|
{
|
||||||
return ConvertToProcessInfo(Process.GetCurrentProcess());
|
return ConvertToProcessInfo(Process.GetCurrentProcess());
|
||||||
|
Loading…
Reference in New Issue
Block a user