|
|
@@ -337,33 +337,25 @@ namespace winsw
|
|
|
StopProcessAndChildren(Convert.ToInt32(mo["ProcessID"]));
|
|
|
}
|
|
|
|
|
|
- try
|
|
|
+ var proc = Process.GetProcessById(pid);
|
|
|
+ WriteEvent("Send SIGINT " + process.Id);
|
|
|
+ bool successful = SigIntHelper.SendSIGINTToProcess(proc,descriptor.StopTimeout);
|
|
|
+ if (successful)
|
|
|
+ {
|
|
|
+ WriteEvent("SIGINT to" + process.Id + " successful");
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- var proc = Process.GetProcessById(pid);
|
|
|
- if (descriptor.SendSIGINT)
|
|
|
+ try
|
|
|
{
|
|
|
- WriteEvent("Send SIGINT " + process.Id);
|
|
|
- bool successful = SigIntHelper.SendSIGINTToProcess(proc);
|
|
|
- if (successful)
|
|
|
- {
|
|
|
- WriteEvent("SIGINT to" + process.Id + " successful");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- WriteEvent("SIGINT to " + process.Id + " failed - Killing as fallback");
|
|
|
- proc.Kill();
|
|
|
- }
|
|
|
+ WriteEvent("SIGINT to " + process.Id + " failed - Killing as fallback");
|
|
|
+ proc.Kill();
|
|
|
}
|
|
|
- else
|
|
|
+ catch (ArgumentException)
|
|
|
{
|
|
|
- WriteEvent("ProcessKill " + process.Id);
|
|
|
- proc.Kill();
|
|
|
+ // Process already exited.
|
|
|
}
|
|
|
}
|
|
|
- catch (ArgumentException)
|
|
|
- {
|
|
|
- // Process already exited.
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void WaitForProcessToExit(Process process)
|