more interrupts, notably for running latex;
authorwenzelm
Thu, 12 Nov 2020 16:27:31 +0100
changeset 72599 76550282267f
parent 72598 d9f2be66ebad
child 72600 2fa4f25d9d07
more interrupts, notably for running latex;
src/Pure/Admin/build_doc.scala
src/Pure/System/progress.scala
src/Pure/Thy/present.scala
--- a/src/Pure/Admin/build_doc.scala	Thu Nov 12 16:07:25 2020 +0100
+++ b/src/Pure/Admin/build_doc.scala	Thu Nov 12 16:27:31 2020 +0100
@@ -50,7 +50,6 @@
     val errs =
       Par_List.map((doc_session: (String, String)) =>
         try {
-          progress.expose_interrupt()
           Present.build_documents(doc_session._2, deps, store, progress = progress)
           None
         }
--- a/src/Pure/System/progress.scala	Thu Nov 12 16:07:25 2020 +0100
+++ b/src/Pure/System/progress.scala	Thu Nov 12 16:27:31 2020 +0100
@@ -54,12 +54,16 @@
     env: Map[String, String] = Isabelle_System.settings(),
     redirect: Boolean = false,
     echo: Boolean = false,
+    watchdog: Time = Time.zero,
     strict: Boolean = true): Process_Result =
   {
-    Isabelle_System.bash(script, cwd = cwd, env = env, redirect = redirect,
-      progress_stdout = echo_if(echo, _),
-      progress_stderr = echo_if(echo, _),
-      strict = strict)
+    val result =
+      Isabelle_System.bash(script, cwd = cwd, env = env, redirect = redirect,
+        progress_stdout = echo_if(echo, _),
+        progress_stderr = echo_if(echo, _),
+        watchdog = if (watchdog.is_zero) None else Some((watchdog, _ => stopped)),
+        strict = strict)
+    if (strict && stopped) throw Exn.Interrupt() else result
   }
 }
 
--- a/src/Pure/Thy/present.scala	Thu Nov 12 16:07:25 2020 +0100
+++ b/src/Pure/Thy/present.scala	Thu Nov 12 16:27:31 2020 +0100
@@ -278,7 +278,8 @@
             "isabelle latex -o " + Bash.string(fmt) + " " + Bash.string(root + "." + ext)
 
           def bash(items: String*): Process_Result =
-            progress.bash(items.mkString(" && "), cwd = doc_dir.file, echo = verbose_latex)
+            progress.bash(items.mkString(" && "), cwd = doc_dir.file,
+              echo = verbose_latex, watchdog = Time.seconds(0.5))
 
 
           // prepare document