mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
Some work on the auto updater #1460
This commit is contained in:
parent
96697000b1
commit
03f7184118
5 changed files with 104 additions and 75 deletions
|
@ -91,27 +91,24 @@ namespace Ombi.Updater
|
|||
}
|
||||
else
|
||||
{
|
||||
var process = Process.GetProcesses().FirstOrDefault(p => p.Id == opts.OmbiProcessId);
|
||||
var process = Process.GetProcesses().FirstOrDefault(p => p.ProcessName == opts.ProcessName);
|
||||
|
||||
if (process == null)
|
||||
{
|
||||
Console.WriteLine("Cannot find process with id: {0}", opts.OmbiProcessId);
|
||||
Console.WriteLine("Cannot find process with name: {0}", opts.ProcessName);
|
||||
return;
|
||||
}
|
||||
|
||||
process.Refresh();
|
||||
|
||||
if (process.Id != Process.GetCurrentProcess().Id && process.HasExited)
|
||||
if (process.Id > 0)
|
||||
{
|
||||
Console.WriteLine("Process has already exited");
|
||||
return;
|
||||
Console.WriteLine("[{0}]: Killing process", process.Id);
|
||||
process.Kill();
|
||||
Console.WriteLine("[{0}]: Waiting for exit", process.Id);
|
||||
process.WaitForExit();
|
||||
Console.WriteLine("[{0}]: Process terminated successfully", process.Id);
|
||||
}
|
||||
|
||||
Console.WriteLine("[{0}]: Killing process", process.Id);
|
||||
process.Kill();
|
||||
Console.WriteLine("[{0}]: Waiting for exit", process.Id);
|
||||
process.WaitForExit();
|
||||
Console.WriteLine("[{0}]: Process terminated successfully", process.Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue