src/Pure/System/command_line.ML
author wenzelm
Sun Aug 05 13:42:21 2012 +0200 (2012-08-05 ago)
changeset 48681 181b91e1d1c1
child 48731 a45ba78abcc1
permissions -rw-r--r--
prefer general Command_Line.tool wrapper (cf. Scala version);
     1 (*  Title:      Pure/System/command_line.ML
     2     Author:     Makarius
     3 
     4 Support for Isabelle/ML command line tools.
     5 *)
     6 
     7 signature COMMAND_LINE =
     8 sig
     9   val tool: (unit -> int) -> 'a
    10 end;
    11 
    12 structure Command_Line: COMMAND_LINE =
    13 struct
    14 
    15 fun tool body =
    16   uninterruptible (fn restore_attributes => fn () =>
    17     let val rc =
    18       restore_attributes body () handle exn =>
    19         (Output.error_msg (ML_Compiler.exn_message exn); if Exn.is_interrupt exn then 130 else 1);
    20     in exit rc; raise Fail "ERROR" end) ();
    21 
    22 end;
    23