Commits

camlspotter committed 2b5f596

removed unix

Comments (0)

Files changed (11)

-name="spotlib"
+name="spotlib_js"
 version="2.2.0"
 description="Spotter's garbages"
-requires="unix,str,pa_ounit"
+requires="str,pa_ounit"
 archive(byte)="spotlib.cmo"
 archive(native)="spotlib.cmx"
 linkopts = ""
 OCAML_BYTE_LINK_FLAGS +=
 OCAML_NATIVE_LINK_FLAGS +=
 
-OCAMLPACKS[]= unix str oUnit pa_ounit
+OCAMLPACKS[]= str oUnit pa_ounit
 
 OCAMLDEPFLAGS= -syntax camlp4o -package pa_ounit.syntax -ppopt -pa-ounit-lib -ppopt Spotlib
 OCAMLPPFLAGS= -syntax camlp4o -package pa_ounit.syntax -ppopt -pa-ounit-lib -ppopt Spotlib
    xlazy
    xformat
    xfilename
-   xunix
    xprintf
    xsys
    xset
    tuple
    spot
 
-LIB = spotlib
+LIB = spotlib_unixless
 
 MyOCamlPackage($(LIB), $(LIBFILES), $(EMPTY), $(EMPTY))
 
-open Base
 open Exn
 
 (* It is very stupid but camlp4 of 4.00.1 has a bug of
   open_out p (fun oc ->
     List.iter (fun l -> 
       output_string oc l; output_char oc '\n') lines)
-
-module Test = struct
-  open Unix
-  
-  type test_unary_result = 
-      [ `TRUE of stats
-      | `FALSE of stats
-      | `Error of Unix.error ]
-  
-  type test_unary = string -> test_unary_result
-  
-  let gen_uop ~stat ~f file : test_unary_result =
-    try 
-      let st = stat file in
-      if f st then `TRUE st else `FALSE st
-    with
-    | Unix_error (error, _, _) -> `Error error
-  ;;
-  
-  let uop = gen_uop ~stat:stat
-  let luop = gen_uop ~stat:lstat
-
-  let simplify f name =
-    match f name with
-    | `TRUE _ -> true
-    | _ -> false
-  ;;
-
-  (*     FILE1 -ef FILE2
-                FILE1 and FILE2 have the same device and inode numbers
-  
-         FILE1 -nt FILE2
-                FILE1 is newer (modification date) than FILE2
-  
-         FILE1 -ot FILE2
-                FILE1 is older than FILE2
-  
-  val _b : test_unary (* FILE exists and is block special*)
-  val _c : test_unary (* FILE exists and is character special*)
-  val _d : test_unary (* FILE exists and is a directory*)
-  *)
-  let _d' = uop &~ fun stat -> stat.st_kind = S_DIR
-  let _d = simplify _d'
-  ;;
-  
-  (*
-  val _e : (* FILE exists*)
-  *)
-  let _e' file = 
-    try let stat = stat file in `TRUE stat with 
-    | Unix_error (error, _, _) -> 
-	match error with
-        | ENOENT -> `FALSE
-        | e -> `Error e
-  ;;
-  let _e = simplify _e'
-
-  (*
-  val _f : test_unary (* FILE exists and is a regular file*)
-  *)
-  let _f' = uop &~ fun stat -> stat.st_kind = S_REG
-  let _f = simplify _f'
-
-  (*
-  val _g : test_unary (* FILE exists and is set-group-ID*)
-  val _G : test_unary (* FILE exists and is owned by the effective group ID*)
-  val _h : test_unary (* FILE exists and is a symbolic link (same as -L)*)
-  *)
-  let _h' = luop &~ fun stat -> stat.st_kind = S_LNK
-  let _h = simplify _h'
-
-  (*
-  val _k : test_unary (* FILE exists and has its sticky bit set*)
-  val _L : test_unary (* FILE exists and is a symbolic link (same as -h)*)
-  *)
-  let _L' = _h'
-  let _L = simplify _L'
-
-  (*
-  val _O : test_unary (* FILE exists and is owned by the effective user ID*)
-  val _p : test_unary (* FILE exists and is a named pipe*)
-  val _r : test_unary (* FILE exists and read permission is granted*)
-  val _s : test_unary (* FILE exists and has a size greater than zero*)
-  *)
-  let _s' = uop &~ fun stat -> stat.st_size > 0
-  let _s = simplify _s'
-
-  (*
-  val _S : test_unary (* FILE exists and is a socket*)
-  
-         -t FD  file descriptor FD is opened on a terminal
-  
-  val _u : test_unary (* FILE exists and its set-user-ID bit is set*)
-  val _w : test_unary (* FILE exists and write permission is granted*)
-  val _x : test_unary (* FILE exists and execute (or search) permission is granted*)
-  *)
-end
 
 val write_lines : string -> string list -> unit
 
-(** /usr/bin/test like file testing *)
-module Test : sig
-  type test_unary = 
-      string  (** file name *)
-      -> [ `TRUE  of Unix.stats
-	 | `FALSE of Unix.stats
-  	 | `Error of Unix.error ]
-	    
-  (*     FILE1 -ef FILE2
-                FILE1 and FILE2 have the same device and inode numbers
-  
-         FILE1 -nt FILE2
-                FILE1 is newer (modification date) than FILE2
-  
-         FILE1 -ot FILE2
-                FILE1 is older than FILE2
-  
-  val _b : string -> bool (* FILE exists and is block special *)
-  val _b' : test_unary (* FILE exists and is block special *)
-  val _c : string -> bool (* FILE exists and is character special *)
-  val _c' : test_unary (* FILE exists and is character special *)
-  *)
-  
-  val _d : string -> bool
-  val _d' : test_unary 
-  (** -d: FILE exists and is a directory *)
-
-  val _e : string -> bool
-  val _e' : string -> 
-    [ `TRUE  of Unix.stats
-    | `FALSE
-    | `Error of Unix.error ]
-  (** -e: FILE exists *)
-
-  val _f : string -> bool
-  val _f' : test_unary 
-  (** -f: FILE exists and is a regular file *)
-
-  (*
-  val _g : string -> bool (* FILE exists and is set-group-ID *)
-  val _g' : test_unary (* FILE exists and is set-group-ID *)
-  val _G : string -> bool (* FILE exists and is owned by the effective group ID *)
-  val _G' : test_unary (* FILE exists and is owned by the effective group ID *)
-  *)
-
-  val _h : string -> bool
-  val _h' : test_unary 
-  (** -h: FILE exists and is a symbolic link (same as -L) *)
-
-  (*
-  val _k : string -> bool (* FILE exists and has its sticky bit set *)
-  val _k' : test_unary (* FILE exists and has its sticky bit set *)
-  *)
-
-  val _L : string -> bool
-  val _L' : test_unary 
-  (** -L: FILE exists and is a symbolic link (same as -h) *)
-
-  (*
-  val _O : string -> bool (* FILE exists and is owned by the effective user ID *)
-  val _O' : test_unary (* FILE exists and is owned by the effective user ID *)
-  val _p : string -> bool (* FILE exists and is a named pipe*)
-  val _p' : test_unary (* FILE exists and is a named pipe*)
-  val _r : string -> bool (* FILE exists and read permission is granted*)
-  val _r' : test_unary (* FILE exists and read permission is granted*)
-  *)
-
-  val _s : string -> bool
-  val _s' : test_unary 
-  (** -s: FILE exists and has a size greater than zero*)
-
-  (*
-  val _S : string -> bool (* FILE exists and is a socket*)
-  val _S' : test_unary (* FILE exists and is a socket*)
-  
-  val _t : string -> bool (* file descriptor FD is opened on a terminal *)
-  val _t' : test_unary (* file descriptor FD is opened on a terminal *)
-  		       IT TAKES FD not FILE!
-  
-  val _u : string -> bool (* FILE exists and its set-user-ID bit is set*)
-  val _u' : test_unary (* FILE exists and its set-user-ID bit is set*)
-  val _w : string -> bool (* FILE exists and write permission is granted*)
-  val _w' : test_unary (* FILE exists and write permission is granted*)
-  val _x : string -> bool (* FILE exists and execute (or search) permission is granted*)
-  val _x' : test_unary (* FILE exists and execute (or search) permission is granted*)
-  *)
-end
 end
 include Xfilename.Pervasives
 
-module Unix = struct
-  include Unix
-  include Xunix
-end
-
 module Printf = struct
   include Printf
   include Xprintf
   let ppf = formatter_of_buffer buf in
   kfprintf (fun ppf -> flush ppf; Buffer.contents buf) ppf fmt
 
+let to_string f v=
+  let buf = Buffer.create 100 in
+  let ppf = formatter_of_buffer buf in
+  f ppf v;
+  flush ppf; 
+  Buffer.contents buf
+
 let ksprintf f fmt =
   let buf = Buffer.create 100 in
   let ppf = formatter_of_buffer buf in
 val sprintf : ('a, t, unit, string) format4 -> 'a
   (** [sprintf] with a better type than the orignal *)
 
+val to_string : (t -> 'a -> unit) -> 'a -> string
+
 val ksprintf : (string -> 'a) -> ('b, t, unit, 'a) format4 -> 'b
-let mkdir = Xunix.mkdir
-
 let checkenv s = try ignore (Sys.getenv s); true with Not_found -> false
 
 let command fmt = Printf.kprintf Sys.command fmt
-val mkdir : ?perm:Unix.file_perm -> string -> 
-  [> `Ok 
-  | `Already_exists of Unix.stats
-  | `Error of Unix.error
-  | `Not_a_directory of Unix.stats ]
-  (** Create a directory of the given name. Does nothing if the
-      directory exists already. 
-
-      Bug: No chmod if the directroy already exists.
-  *)
-      
 val checkenv : string -> bool
   (** check existence of environment variable *)
 

lib/xunix.ml

-open Base
-open Unix
-
-(* run [f] on files in [path] *)
-let folddir ~f ~init path =
-  let dh = opendir path in
-  Exn.protect' (fun () ->
-    let rec loop st =
-      try
-        let st' = f st (readdir dh) in
-        loop st'
-      with
-      | End_of_file -> st
-    in
-    loop init)
-    ~finally:(fun _ -> closedir dh)
-
-
-module Inodes = Set.Make(struct
-  type t = int * int
-  let compare : t -> t -> int = compare
-end)
-
-module Find = struct
-
-  exception Prune
-
-  class type path = object
-    method base : string
-    method depth : int
-    method dev_inode : (int * int, exn) Result.t
-    method dir : string
-    method is_dir : bool
-    method is_ldir : bool
-    method is_reg : bool
-    method kind : (Unix.file_kind, exn) Result.t
-    method lkind : (Unix.file_kind, exn) Result.t
-    method path : string
-    method stat : (Unix.stats, exn) Result.t
-    method lstat : (Unix.stats, exn) Result.t
-  end
-
-  class path_ ~dir ~base ~depth = 
-    let path = match Filename.concat dir base with
-      | "./." -> "."
-      | s -> s
-    in
-    object (self)
-      method dir = dir
-      method base = base
-      method path = path
-      method depth : int = depth
-      method stat : (_,_) Result.t = try `Ok (stat path) with e -> `Error e
-      method lstat : (_,_) Result.t = try `Ok (lstat path) with e -> `Error e
-      method kind : (_,_) Result.t = match self#stat with
-        | `Error _exn -> `Error _exn
-        | `Ok stat -> `Ok stat.st_kind
-      method lkind : (_,_) Result.t = match self#lstat with
-        | `Error _exn -> `Error _exn
-        | `Ok stat -> `Ok stat.st_kind
-      method is_dir = self#kind = `Ok S_DIR
-      method is_ldir = self#lkind = `Ok S_DIR
-      method is_reg = self#kind = `Ok S_REG
-      method dev_inode : (_,_) Result.t = match self#stat with
-      | `Ok stat -> `Ok (stat.st_dev, stat.st_ino)
-      | `Error e -> `Error e
-    end
-
-  let prune () = raise Prune
-  
-  let find ?(follow_symlink=false) ~f fnames =
-  
-    (* visited cache *)
-    let visited = ref Inodes.empty in
-    let if_not_visited_then path ~f = match path#dev_inode with
-      | `Error _ -> ()
-      | `Ok inode ->
-          if Inodes.mem inode !visited then ()
-          else begin
-            visited := Inodes.add inode !visited;
-            f path
-          end
-    in
-  
-    let rec find_dir pth =
-      try 
-        f pth;
-        let subdirs =
-          folddir pth#path ~init:[] ~f:(fun dirs -> function
-            | "." | ".." -> dirs
-            | name -> 
-        	let pth = new path_ ~depth:(pth#depth + 1) ~dir:pth#path ~base:name in
-        	if try if follow_symlink then pth#is_dir else pth#is_ldir with _ -> false then pth::dirs
-        	else begin find_non_dir pth; dirs end)
-        in
-        List.iter (if_not_visited_then ~f:find_dir) subdirs
-      with
-      | Prune -> ()
-  
-    and find_non_dir path = try f path with Prune -> ()
-      (* Even if path is a dangling symlink, f path is called *)
-    in
-  
-    List.iter (fun fname ->
-      let path = 
-        new path_ ~depth: 0 ~dir:(Filename.dirname fname) ~base:(Filename.basename fname)
-      in
-      if path#is_dir then find_dir path
-      else find_non_dir path) fnames
-  
-end
-
-let try_set_close_on_exec fd =
-  try set_close_on_exec fd; true with Invalid_argument _ -> false
-
-    
-module Process_status = struct
-
-  type t = [ `Exited of int | `Signaled of int | `Stopped of int ]  
-
-  let failwith ?name = 
-    let name = match name with None -> "" | Some n -> n ^ ": " in
-    function
-      | `Exited n   -> Exn.failwithf "%sprocess exited with id %d" name n
-      | `Signaled n -> Exn.failwithf "%sprocess killed by signal %d" name n
-      | `Stopped n  -> Exn.failwithf "%sprocess stopped by signal %d" name n
-
-  let convert = function
-    | WEXITED n   -> `Exited n
-    | WSIGNALED n -> `Signaled n
-    | WSTOPPED n  -> `Stopped n
-end
-
-let open_proc_full cmdargs input output error toclose =
-  let cmd = match cmdargs with
-    | x :: _ -> x
-    | _ -> invalid_arg "Xunix.gen_open_proc_full"
-  in
-  let cmdargs = Array.of_list cmdargs in
-  let cloexec = List.for_all try_set_close_on_exec toclose in
-  match fork() with
-    0 ->
-      dup2 input stdin; close input;
-      dup2 output stdout; close output;
-      dup2 error stderr; close error;
-      if not cloexec then List.iter close toclose;
-      begin try execvp cmd cmdargs with _ -> exit 127
-      end (* never return *)
-  | id -> id
-
-
-let open_process_full cmdargs =
-  let (in_read, in_write) = pipe() in
-  let (out_read, out_write) = pipe() in
-  let (err_read, err_write) = pipe() in
-  let pid = open_proc_full cmdargs
-    out_read in_write err_write [in_read; out_write; err_read]
-  in
-  close out_read;
-  close in_write;
-  close err_write;
-  pid, (in_read, out_write, err_read)
-
-    
-let open_shell_process_full cmd = open_process_full [ "/bin/sh"; "-c"; cmd ]
-
-
-let buf_flush_limit = 100000
-
-    
-let command_aux readers stat =
-  let read_buflen = 4096 in
-  let read_buf = String.create read_buflen in
-
-  let try_read_lines fd buf : (string list * bool (* eof *)) =
-    let read_bytes = 
-      try Some (read fd read_buf 0 read_buflen) with
-      | Unix_error ((EAGAIN | EWOULDBLOCK), _, _) -> None
-    in
-    match read_bytes with
-    | None -> [], false
-    | Some 0 -> (* eof *)
-        let s = Buffer.contents buf in
-        (if s = "" then [] else [s]), true
-    | Some len ->
-        let buffer_old_len = Buffer.length buf in
-        Buffer.add_substring buf read_buf 0 len;
-
-        let pos_in_buffer pos = buffer_old_len + pos in
-        
-        let rec get_lines st from_in_buffer pos =  
-          match
-            if pos >= len then None
-            else Xstring.index_from_to read_buf pos (len-1) '\n'
-          with
-          | None ->
-              let rem =
-                Buffer.sub buf
-                  from_in_buffer
-                  (Buffer.length buf - from_in_buffer)
-              in
-              Buffer.clear buf;
-              if String.length rem > buf_flush_limit then rem :: st
-              else begin
-                Buffer.add_string buf rem; st
-              end
-          | Some pos ->
-              let next_from_in_buffer = pos_in_buffer pos + 1 in
-              let line =
-                Buffer.sub buf
-                  from_in_buffer
-                  (next_from_in_buffer - from_in_buffer)
-              in
-              get_lines (line :: st) next_from_in_buffer (pos + 1)
-        in
-        List.rev (get_lines [] 0 0), false
-  in
-
-  let rec loop readers stat =
-    if readers = [] then stat (* no more reader and no need to loop *)
-    else begin
-      let fds = List.map (fun (fd, _, _) -> fd) readers in 
-      let readables, _, _ = select fds [] [](*?*) (-1.0)(*?*) in
-      let readers', stat = 
-        List.fold_right (fun (fd, buf, fs as reader) (st, stat) ->
-          if not (List.mem fd readables) then
-            (reader :: st, stat)
-          else begin
-            let rec loop stat =
-              let lines, is_eof = try_read_lines fd buf in
-              if lines <> [] then begin
-                let stat = 
-                  List.fold_left (fun stat line ->
-                    List.fold_left (fun stat f -> f stat (`Read line)) stat fs) stat lines
-                in
-                if not is_eof then loop stat else is_eof, stat
-              end else is_eof, stat 
-            in
-            match loop stat with
-            | true (*eof*), stat ->
-	        (* reached eof. remove the reader *)
-	        let stat = List.fold_left (fun stat f -> f stat `EOF) stat fs in
-                close fd; 
-	        st, stat
-            | false, stat -> reader :: st, stat
-          end) readers ([], stat)
-      in
-      loop readers' stat
-    end
-  in
-  loop readers stat
-
-
-let rec waitpid_non_intr pid =
-  try 
-    waitpid [] pid 
-  with Unix_error (EINTR, _, _) -> waitpid_non_intr pid
-
-    
-let command_wrapper (pid, (out, in_, err)) f ~init:stat =
-  try
-    close in_;
-    set_nonblock out;
-    set_nonblock err;
-    
-    let buf_out = Buffer.create buf_flush_limit in
-    let buf_err = Buffer.create buf_flush_limit in
-
-    let stat = command_aux
-      [out, buf_out, [fun stat s -> f stat (`Out, s)];
-       err, buf_err, [fun stat s -> f stat (`Err, s)]] stat 
-    in
-    Process_status.convert & snd & waitpid_non_intr pid, 
-    stat
-  with
-  | e ->
-      (* kill really ? *)
-      kill pid 9;
-      ignore (waitpid_non_intr pid);
-      raise e
-
-
-let print_all = function
-  | `Err, `Read s -> prerr_endline & Xstring.chop_newline s
-  | `Out, `Read s -> print_endline & Xstring.chop_newline s
-  | _ -> ()
-
-let command ?(f=print_all) cmd = 
-  fst & command_wrapper (open_process_full cmd) (fun () -> f) ~init:()
-
-let shell_command ?(f=print_all) cmd = 
-  fst & command_wrapper (open_shell_process_full cmd) (fun () -> f) ~init:() 
-
-let command' cmd = command_wrapper (open_process_full cmd)
-let shell_command' cmd = command_wrapper (open_shell_process_full cmd)
-
-let shell_command_stdout cmd = 
-  match 
-    command_wrapper (open_shell_process_full cmd) ~init:[] (fun rev -> function 
-      | `Err, `Read s -> prerr_endline & Xstring.chop_newline s; rev
-      | `Out, `Read s ->  s :: rev
-      | _ -> rev)
-  with
-  | stat, rev -> stat, List.rev rev
-
-
-let cmp p1 p2 = 
-  match command ["cmp"; p1; p2] ~f:ignore with
-  | `Exited 0 -> `Same
-  | `Exited 1 -> `Different
-  | `Exited 2 -> `Error
-  | _ -> `Error (* something extremely wrong happened *)
-
-let gen_timed get minus f v = 
-  let t1 = get () in
-  let res = f v  in
-  let t2 = get () in
-  res, minus t2 t1
-
-let timed f v = gen_timed Unix.gettimeofday (-.) f v
-
-module Process_times = struct
-  type t = process_times
-  let (-) pt1 pt2 = {
-    tms_utime = pt1.tms_utime  -. pt2.tms_utime;
-    tms_stime = pt1.tms_stime  -. pt2.tms_stime;
-    tms_cutime = pt1.tms_utime -. pt2.tms_cutime;
-    tms_cstime = pt1.tms_utime -. pt2.tms_cstime;
-  }
-  let timed f v = gen_timed Unix.times (-) f v
-end
-
-let file path = 
-  match 
-    command' ["/usr/bin/file"; path] ~init:[] & fun revls -> function
-      | `Out, `Read s -> s::revls
-      | _ -> revls
-  with
-  | `Exited 0, [] -> `Error `Empty_result
-  | `Exited 0, lines -> `Ok (Xlist.last lines)
-  | st, _ -> `Error st
-
-let mkdir ?(perm=0o700) s =
-  match File.Test._d' s with
-  | `Error ENOENT -> 
-      begin try
-	mkdir s perm; (* CR jfuruse: use umask? *)
-	`Ok
-      with
-      | Unix_error (e,_,_) -> `Error e
-      end
-  | `TRUE st -> `Already_exists st (* CR jfuruse: perm check ? *)
-  | `FALSE st -> `Not_a_directory st
-  | `Error e -> `Error e
-
-
-let mkdtemp template =
-  match Xstring.is_postfix' "XXXXXX" template with
-  | None -> 
-      Exn.invalid_argf "Unix.mkdtemp must take an argument whose postfix is \"XXXXXX\""
-  | Some prefix ->
-      let rec find () =
-        let d = !% "%s%06d" prefix & Random.int 1000000 in
-        if Sys.file_exists d then find ()
-        else d
-      in
-      let d = find () in
-      Unix.mkdir d 0o700;
-      d
-
-let with_dtemp template f =
-  let d = mkdtemp template in
-  Exn.protect' (fun () -> f d) ~finally:(fun () ->
-    if ksprintf Sys.command "/bin/rm -rf %s" d <> 0 then
-      Exn.failwithf "Unix.with_dtemp: cleaning tempdir %s failed" d)
-  

lib/xunix.mli

-open Unix
-
-module Find : sig
-
-  class type path = object
-    method base : string
-    method depth : int
-    method dev_inode : (int * int, exn) Result.t
-    method dir : string
-    method is_dir : bool
-    method is_ldir : bool
-    method is_reg : bool
-    method kind : (Unix.file_kind, exn) Result.t
-    method lkind : (Unix.file_kind, exn) Result.t
-    method path : string
-    method stat : (Unix.stats, exn) Result.t
-    method lstat : (Unix.stats, exn) Result.t
-  end
-
-  val prune : unit -> 'a
-  val find : ?follow_symlink:bool -> f:(path -> unit) -> string list -> unit
-
-end
-
-module Process_status : sig
-
-  type t = [ `Exited of int | `Signaled of int | `Stopped of int ]  
-
-  val failwith : ?name:string -> [< t ] -> 'a
-
-  val convert : Unix.process_status -> [> t ]
-  (** Constructors of [Unix.process_status] are hard to remember,
-      we here convert them to polyvars *)
-end
-
-val shell_command :
-  ?f: ([> `Out | `Err] * [ `Read of string | `EOF ] -> unit) 
-  -> string 
-  -> [> Process_status.t ]
-(** Execute a shell command using /bin/sh *)
-
-val command :
-  ?f: ([> `Out | `Err] * [ `Read of string | `EOF ] -> unit) 
-  -> string list
-  -> [> Process_status.t ]
-(** Same as [shell_command] but it takes the command and arguments as a list of string,
-    then directly executed by [Unix.execvp]. *)
-
-val shell_command' :
-  string 
-  -> ('st -> [> `Out | `Err] * [ `Read of string | `EOF ] -> 'st) 
-  -> init: 'st 
-  -> [> Process_status.t ] * 'st
-(** Execute a shell command using /bin/sh *)
-
-val command' :
-  string list
-  -> ('st -> [> `Out | `Err] * [ `Read of string | `EOF ] -> 'st) 
-  -> init: 'st
-  -> [> Process_status.t ] * 'st
-(** Same as [shell_command] but it takes the command and arguments as a list of string,
-    then directly executed by [Unix.execvp]. *)
-
-val shell_command_stdout :
-  string -> [> Process_status.t ] * string list
-(** Execute a shell command using /bin/sh
-    Err is printed to stderr.
- *)
-
-val cmp : string -> string -> [`Same | `Different | `Error]
-(** Execute "cmp", the file comparison unix command by execvp *)
-  
-val file : string -> [> `Error of [> `Empty_result 
-                                  | Process_status.t ]
-                     | `Ok of string ]
-(** Execute "file path" *)
-
-val timed : ('a -> 'b) -> 'a -> 'b * float (* in sec *)
-
-module Process_times : sig
-  type t = process_times
-  val (-) : t -> t -> t
-  val timed : ('a -> 'b) -> 'a -> 'b * t
-end
-
-val mkdir : ?perm:Unix.file_perm -> string -> 
-  [> `Ok 
-  | `Already_exists of Unix.stats
-  | `Error of Unix.error
-  | `Not_a_directory of Unix.stats ]
-  (** Create a directory of the given name. Does nothing if the
-      directory exists already. 
-
-      Bug: No chmod if the directroy already exists.
-  *)
-
-val mkdtemp : string -> string
-(** Like mkdtemp(3). It must take a template whose postfix is "XXXXXX".
-    It creates a new directory name by replacing "XXXXXX" by random number then creates a directory
-    of permission 0o700 
-*)
-
-val with_dtemp : string -> (string -> 'a) -> 'a
-(** [with_dtemp template f] creates a temp directory [dir] using 
-    [mkdtemp template] then runs [f dir]. 
-    The temp directory [dir] is automatically removed 
-    (even if it is not empty) after [f dir].
-*)
- 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.