src/Pure/Concurrent/bash_sequential.ML
changeset 43850 7f2cbc713344
parent 43847 529159f81d06
child 44054 da5fcc0f6c52
equal deleted inserted replaced
43849:00f4b305687d 43850:7f2cbc713344
     3 
     3 
     4 Generic GNU bash processes (no provisions to propagate interrupts, but
     4 Generic GNU bash processes (no provisions to propagate interrupts, but
     5 could work via the controlling tty).
     5 could work via the controlling tty).
     6 *)
     6 *)
     7 
     7 
     8 fun bash_process script =
     8 structure Bash =
       
     9 struct
       
    10 
       
    11 fun process script =
     9   let
    12   let
    10     val id = serial_string ();
    13     val id = serial_string ();
    11     val script_path = File.tmp_path (Path.basic ("bash_script" ^ id));
    14     val script_path = File.tmp_path (Path.basic ("bash_script" ^ id));
    12     val output_path = File.tmp_path (Path.basic ("bash_output" ^ id));
    15     val output_path = File.tmp_path (Path.basic ("bash_output" ^ id));
    13     fun cleanup () = (try File.rm script_path; try File.rm output_path);
    16     fun cleanup () = (try File.rm script_path; try File.rm output_path);
    30       val _ = cleanup ();
    33       val _ = cleanup ();
    31     in {output = output, rc = rc, terminate = fn () => ()} end
    34     in {output = output, rc = rc, terminate = fn () => ()} end
    32     handle exn => (cleanup (); reraise exn)
    35     handle exn => (cleanup (); reraise exn)
    33   end;
    36   end;
    34 
    37 
       
    38 end;
       
    39