src/Pure/System/bash.scala
changeset 76146 a64f3496d93a
parent 75393 87ebf5a50283
child 78910 d305af09fbad
equal deleted inserted replaced
76145:a6bdf4b889ca 76146:a64f3496d93a
   144     def interrupt(): Unit = Isabelle_Thread.try_uninterruptible {
   144     def interrupt(): Unit = Isabelle_Thread.try_uninterruptible {
   145       isabelle.setup.Environment.kill_process(group_pid, "INT")
   145       isabelle.setup.Environment.kill_process(group_pid, "INT")
   146     }
   146     }
   147 
   147 
   148 
   148 
   149     // JVM shutdown hook
       
   150 
       
   151     private val shutdown_hook = Isabelle_Thread.create(() => terminate())
       
   152 
       
   153     try { Runtime.getRuntime.addShutdownHook(shutdown_hook) }
       
   154     catch { case _: IllegalStateException => }
       
   155 
       
   156 
       
   157     // cleanup
   149     // cleanup
   158 
   150 
       
   151     private val shutdown_hook =
       
   152       Isabelle_System.create_shutdown_hook { terminate() }
       
   153 
   159     private def do_cleanup(): Unit = {
   154     private def do_cleanup(): Unit = {
   160       try { Runtime.getRuntime.removeShutdownHook(shutdown_hook) }
   155       Isabelle_System.remove_shutdown_hook(shutdown_hook)
   161       catch { case _: IllegalStateException => }
       
   162 
   156 
   163       script_file.delete()
   157       script_file.delete()
   164       winpid_file.foreach(_.delete())
   158       winpid_file.foreach(_.delete())
   165 
   159 
   166       timing.change {
   160       timing.change {