Created
August 24, 2010 15:14
-
-
Save ajorg/547712 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/MonkeyWrench/ProcessHelperLinux.cs b/MonkeyWrench/ProcessHelperLinux.cs | |
index 9707d0f..380e533 100755 | |
--- a/MonkeyWrench/ProcessHelperLinux.cs | |
+++ b/MonkeyWrench/ProcessHelperLinux.cs | |
@@ -50,6 +50,18 @@ namespace MonkeyWrench | |
/// <param name="pids"></param> | |
internal static void KillImpl (IEnumerable<int> pids) | |
{ | |
+ using (Process quit = new Process ()) { | |
+ quit.StartInfo.FileName = "kill"; | |
+ quit.StartInfo.Arguments = "-QUIT "; | |
+ foreach (int pid in pids) { | |
+ quit.StartInfo.Arguments += pid.ToString () + " "; | |
+ } | |
+ quit.StartInfo.UseShellExecute = false; | |
+ quit.Start (); | |
+ | |
+ if (!quit.WaitForExit (1000 * 15 /* 15 seconds */)) | |
+ throw new ApplicationException (string.Format ("The 'kill -QUIT' process didn't exit in 15 seconds.")); | |
+ } | |
using (Process kill = new Process ()) { | |
kill.StartInfo.FileName = "kill"; | |
kill.StartInfo.Arguments = "-9 "; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment