src/Pure/System/command_line.ML
author wenzelm
Mon Jul 15 10:25:35 2013 +0200 (2013-07-15 ago)
changeset 52655 3b2b1ef13979
parent 51312 0ce544fbb509
child 52686 f4871fe80410
permissions -rw-r--r--
more careful termination of removed execs, leaving running execs undisturbed;
     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) -> unit
    10   val tool0: (unit -> unit) -> unit
    11 end;
    12 
    13 structure Command_Line: COMMAND_LINE =
    14 struct
    15 
    16 fun tool body =
    17   uninterruptible (fn restore_attributes => fn () =>
    18     let val rc =
    19       restore_attributes body () handle exn =>
    20         (Output.error_msg (ML_Compiler.exn_message exn); if Exn.is_interrupt exn then 130 else 1);
    21     in if rc = 0 then () else exit rc end) ();
    22 
    23 fun tool0 body = tool (fn () => (body (); 0));
    24 
    25 end;
    26