src/Pure/System/command_line.ML
author wenzelm
Tue, 07 Aug 2012 17:08:22 +0200
changeset 48710 5b51ccdc8623
parent 48681 181b91e1d1c1
child 48731 a45ba78abcc1
permissions -rw-r--r--
prefer static Build.session_content for loaded theories -- discontinued incremental protocol;

(*  Title:      Pure/System/command_line.ML
    Author:     Makarius

Support for Isabelle/ML command line tools.
*)

signature COMMAND_LINE =
sig
  val tool: (unit -> int) -> 'a
end;

structure Command_Line: COMMAND_LINE =
struct

fun tool body =
  uninterruptible (fn restore_attributes => fn () =>
    let val rc =
      restore_attributes body () handle exn =>
        (Output.error_msg (ML_Compiler.exn_message exn); if Exn.is_interrupt exn then 130 else 1);
    in exit rc; raise Fail "ERROR" end) ();

end;