safe_exit: controlled_execution;
authorwenzelm
Sun, 28 Oct 2007 11:57:04 +0100
changeset 25219 084f468145e3
parent 25218 fcf0f50e478c
child 25220 f22c1fcbc501
safe_exit: controlled_execution;
src/Pure/Isar/toplevel.ML
--- a/src/Pure/Isar/toplevel.ML	Sat Oct 27 18:37:33 2007 +0200
+++ b/src/Pure/Isar/toplevel.ML	Sun Oct 28 11:57:04 2007 +0100
@@ -306,8 +306,8 @@
   else f x;
 
 fun interruptible f x =
-  let val y = ref x
-  in raise_interrupt (fn () => y := f x) (); ! y end;
+  let val y = ref NONE
+  in raise_interrupt (fn () => y := SOME (f x)) (); the (! y) end;
 
 fun toplevel_error f x = f x
   handle exn => (Output.error_msg (exn_message exn); raise TOPLEVEL_ERROR);
@@ -401,7 +401,7 @@
 
 fun safe_exit (Toplevel (SOME (node, (exit, _)))) =
     (case try the_global_theory (History.current node) of
-      SOME thy => exit thy
+      SOME thy => controlled_execution exit thy
     | NONE => ())
   | safe_exit _ = ();