more robust handling of repeated interrupts while terminating managed process;
NB: InterruptedException should have interrupted status cleared already;
--- a/src/Pure/System/isabelle_system.scala Sat Feb 23 17:12:48 2013 +0100
+++ b/src/Pure/System/isabelle_system.scala Sat Feb 23 17:47:51 2013 +0100
@@ -298,8 +298,11 @@
private def kill(signal: String): Boolean =
{
- execute(true, "kill", "-" + signal, "-" + pid).waitFor
- execute(true, "kill", "-0", "-" + pid).waitFor == 0
+ try {
+ execute(true, "kill", "-" + signal, "-" + pid).waitFor
+ execute(true, "kill", "-0", "-" + pid).waitFor == 0
+ }
+ catch { case _: InterruptedException => true }
}
private def multi_kill(signal: String): Boolean =
@@ -308,7 +311,7 @@
var count = 10
while (running && count > 0) {
if (kill(signal)) {
- Thread.sleep(100)
+ try { Thread.sleep(100) } catch { case _: InterruptedException => }
count -= 1
}
else running = false
@@ -363,7 +366,7 @@
val rc =
try { proc.join }
- catch { case e: InterruptedException => Thread.interrupted; proc.terminate; 130 }
+ catch { case e: InterruptedException => proc.terminate; 130 }
Bash_Result(stdout.join, stderr.join, rc)
}
}