1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-27 02:07:41 +00:00

GetCurrentProcessId for PidFileProvider

This commit is contained in:
Mark McDowall 2015-06-05 23:12:29 -07:00
parent aa4fca7177
commit 6fd7a64330
2 changed files with 7 additions and 1 deletions

View file

@ -33,7 +33,7 @@ namespace NzbDrone.Common.Processes
var filename = Path.Combine(_appFolderInfo.AppDataFolder, "nzbdrone.pid");
try
{
File.WriteAllText(filename, _processProvider.GetCurrentProcess().Id.ToString());
File.WriteAllText(filename, _processProvider.GetCurrentProcessId().ToString());
}
catch (Exception ex)
{

View file

@ -12,6 +12,7 @@ namespace NzbDrone.Common.Processes
{
public interface IProcessProvider
{
int GetCurrentProcessId();
ProcessInfo GetCurrentProcess();
ProcessInfo GetProcessById(int id);
List<ProcessInfo> FindProcessByName(string name);
@ -40,6 +41,11 @@ namespace NzbDrone.Common.Processes
_logger = logger;
}
public int GetCurrentProcessId()
{
return Process.GetCurrentProcess().Id;
}
public ProcessInfo GetCurrentProcess()
{
return ConvertToProcessInfo(Process.GetCurrentProcess());