more informative process exit code;
authorwenzelm
Fri, 03 Aug 2012 16:00:12 +0200
changeset 48662 b171bcd5dd86
parent 48661 9149ebdd0241
child 48663 49c080255a57
more informative process exit code;
lib/scripts/run-polyml
lib/scripts/run-smlnj
src/Pure/System/build.ML
src/Pure/build
src/Tools/Code/lib/Tools/codegen
--- a/lib/scripts/run-polyml	Fri Aug 03 14:52:45 2012 +0200
+++ b/lib/scripts/run-polyml	Fri Aug 03 16:00:12 2012 +0200
@@ -46,10 +46,10 @@
 
 if [ -z "$INFILE" ]; then
   INIT=""
-  EXIT="fun exit 0 = (OS.Process.exit OS.Process.success): unit | exit _ = OS.Process.exit OS.Process.failure;"
+  EXIT="fun exit rc : unit = Posix.Process.exit (Word8.fromInt rc);"
 else
   check_file "$INFILE"
-  INIT="(Signal.signal (2, Signal.SIG_HANDLE (fn _ => Process.interruptConsoleProcesses ())); PolyML.SaveState.loadState \"$INFILE\" handle Fail msg => (TextIO.output (TextIO.stdErr, msg ^ \": $INFILE\\n\"); OS.Process.exit OS.Process.failure));"
+  INIT="(Signal.signal (2, Signal.SIG_HANDLE (fn _ => Process.interruptConsoleProcesses ())); PolyML.SaveState.loadState \"$INFILE\" handle Fail msg => (TextIO.output (TextIO.stdErr, msg ^ \": $INFILE\\n\"); Posix.Process.exit 0w1));"
   EXIT=""
 fi
 
--- a/lib/scripts/run-smlnj	Fri Aug 03 14:52:45 2012 +0200
+++ b/lib/scripts/run-smlnj	Fri Aug 03 16:00:12 2012 +0200
@@ -52,7 +52,7 @@
 ## prepare databases
 
 if [ -z "$INFILE" ]; then
-  EXIT="fun exit 0 = (OS.Process.exit OS.Process.success): unit | exit _ = OS.Process.exit OS.Process.failure;"
+  EXIT="fun exit rc : unit = Posix.Process.exit (Word8.fromInt rc);"
   DB=""
 else
   EXIT=""
--- a/src/Pure/System/build.ML	Fri Aug 03 14:52:45 2012 +0200
+++ b/src/Pure/System/build.ML	Fri Aug 03 16:00:12 2012 +0200
@@ -79,7 +79,9 @@
     val _ = Session.finish ();
     val _ = if do_output then () else quit ();
   in () end
-  handle exn => (Output.error_msg (ML_Compiler.exn_message exn); exit 1);
+  handle exn =>
+    (Output.error_msg (ML_Compiler.exn_message exn);
+     if Exn.is_interrupt exn then exit 130 else exit 1);
 
 end;
 
--- a/src/Pure/build	Fri Aug 03 14:52:45 2012 +0200
+++ b/src/Pure/build	Fri Aug 03 16:00:12 2012 +0200
@@ -61,11 +61,11 @@
 if [ "$TARGET" = RAW ]; then
   if [ -z "$OUTPUT" ]; then
     "$ISABELLE_PROCESS" \
-      -e "use\"$COMPAT\" handle _ => OS.Process.exit OS.Process.failure;" \
+      -e "use\"$COMPAT\" handle _ => Posix.Process.exit 0w1;" \
       -q RAW_ML_SYSTEM
   else
     "$ISABELLE_PROCESS" \
-      -e "use\"$COMPAT\" handle _ => OS.Process.exit OS.Process.failure;" \
+      -e "use\"$COMPAT\" handle _ => Posix.Process.exit 0w1;" \
       -e "structure Isar = struct fun main () = () end;" \
       -e "ml_prompts \"ML> \" \"ML# \";" \
       -q -w RAW_ML_SYSTEM "$OUTPUT"
@@ -73,11 +73,11 @@
 else
   if [ -z "$OUTPUT" ]; then
     "$ISABELLE_PROCESS" \
-      -e "(use\"$COMPAT\"; use\"ROOT.ML\") handle _ => OS.Process.exit OS.Process.failure;" \
+      -e "(use\"$COMPAT\"; use\"ROOT.ML\") handle _ => Posix.Process.exit 0w1;" \
       -q RAW_ML_SYSTEM
   else
     "$ISABELLE_PROCESS" \
-      -e "(use\"$COMPAT\"; use\"ROOT.ML\") handle _ => OS.Process.exit OS.Process.failure;" \
+      -e "(use\"$COMPAT\"; use\"ROOT.ML\") handle _ => Posix.Process.exit 0w1;" \
       -e "ml_prompts \"ML> \" \"ML# \";" \
       -f -q -w RAW_ML_SYSTEM "$OUTPUT"
   fi
--- a/src/Tools/Code/lib/Tools/codegen	Fri Aug 03 14:52:45 2012 +0200
+++ b/src/Tools/Code/lib/Tools/codegen	Fri Aug 03 16:00:12 2012 +0200
@@ -52,7 +52,7 @@
 
 FORMAL_CMD="Toplevel.program (fn () => (use_thy thyname; ML_Context.eval_text_in \
   (SOME (Proof_Context.init_global (Thy_Info.get_theory thyname))) false Position.none ml_cmd)) \
-  handle _ => OS.Process.exit OS.Process.failure;"
+  handle _ => Posix.Process.exit 0w1;"
 
 ACTUAL_CMD="val thyname = \"$THYNAME\"; \
   val _ = quick_and_dirty := $QUICK_AND_DIRTY; \