src/Pure/System/isabelle_system.ML
changeset 59351 bb6eecfd7a55
parent 57085 cb212f52c2a3
child 60013 42d34eeb283c
equal deleted inserted replaced
59350:acba5d6fdb2f 59351:bb6eecfd7a55
    13   val copy_file: Path.T -> Path.T -> unit
    13   val copy_file: Path.T -> Path.T -> unit
    14   val copy_file_base: Path.T * Path.T -> Path.T -> unit
    14   val copy_file_base: Path.T * Path.T -> Path.T -> unit
    15   val create_tmp_path: string -> string -> Path.T
    15   val create_tmp_path: string -> string -> Path.T
    16   val with_tmp_file: string -> string -> (Path.T -> 'a) -> 'a
    16   val with_tmp_file: string -> string -> (Path.T -> 'a) -> 'a
    17   val with_tmp_dir: string -> (Path.T -> 'a) -> 'a
    17   val with_tmp_dir: string -> (Path.T -> 'a) -> 'a
    18   val with_tmp_fifo: (Path.T -> 'a) -> 'a
       
    19   val bash_output: string -> string * int
    18   val bash_output: string -> string * int
    20   val bash: string -> int
    19   val bash: string -> int
    21 end;
    20 end;
    22 
    21 
    23 structure Isabelle_System: ISABELLE_SYSTEM =
    22 structure Isabelle_System: ISABELLE_SYSTEM =
   112   let
   111   let
   113     val path = create_tmp_path name "";
   112     val path = create_tmp_path name "";
   114     val _ = mkdirs path;
   113     val _ = mkdirs path;
   115   in Exn.release (Exn.capture f path before ignore (try rm_tree path)) end;
   114   in Exn.release (Exn.capture f path before ignore (try rm_tree path)) end;
   116 
   115 
   117 
       
   118 (* fifo *)
       
   119 
       
   120 fun with_tmp_fifo f =
       
   121   with_tmp_file "isabelle-fifo-" ""
       
   122     (fn path =>
       
   123       (case bash_output ("mkfifo -m 600 " ^ File.shell_path path) of
       
   124         (_, 0) => f path
       
   125       | (out, _) => error (trim_line out)));
       
   126 
       
   127 end;
   116 end;
   128 
   117