mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
!wip try a different way to update
This commit is contained in:
parent
368d644741
commit
760987579a
4 changed files with 61 additions and 58 deletions
|
@ -73,33 +73,32 @@ namespace Ombi.Updater
|
|||
process.PriorityClass = priority;
|
||||
}
|
||||
|
||||
public void Kill(StartupOptions opts)
|
||||
public bool Kill(StartupOptions opts)
|
||||
{
|
||||
if (opts.IsWindowsService)
|
||||
{
|
||||
Console.WriteLine("Stopping Service {0}", opts.WindowsServiceName);
|
||||
var process = new Process();
|
||||
var startInfo =
|
||||
new ProcessStartInfo
|
||||
{
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
FileName = "cmd.exe",
|
||||
Arguments = $"/C net stop \"{opts.WindowsServiceName}\""
|
||||
};
|
||||
process.StartInfo = startInfo;
|
||||
process.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (opts.IsWindowsService)
|
||||
//{
|
||||
// Console.WriteLine("Stopping Service {0}", opts.WindowsServiceName);
|
||||
// var process = new Process();
|
||||
// var startInfo =
|
||||
// new ProcessStartInfo
|
||||
// {
|
||||
// WindowStyle = ProcessWindowStyle.Hidden,
|
||||
// FileName = "cmd.exe",
|
||||
// Arguments = $"/C net stop \"{opts.WindowsServiceName}\""
|
||||
// };
|
||||
// process.StartInfo = startInfo;
|
||||
// process.Start();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
var process = Process.GetProcesses().FirstOrDefault(p => p.ProcessName == opts.ProcessName);
|
||||
|
||||
if (process == null)
|
||||
{
|
||||
Console.WriteLine("Cannot find process with name: {0}", opts.ProcessName);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
process.Refresh();
|
||||
|
||||
|
||||
if (process.Id > 0)
|
||||
{
|
||||
|
@ -108,8 +107,12 @@ namespace Ombi.Updater
|
|||
Console.WriteLine("[{0}]: Waiting for exit", process.Id);
|
||||
process.WaitForExit();
|
||||
Console.WriteLine("[{0}]: Process terminated successfully", process.Id);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
//}
|
||||
}
|
||||
|
||||
public void KillAll(string processName)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue