Commits

camlspotter committed 4549aa4

fixed type of command,must, and moved mkdir to unix

Comments (0)

Files changed (2)

-open Unix
-
-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 mkdir = Xunix.mkdir
 
 let checkenv s = try ignore (Sys.getenv s); true with Not_found -> false
 
-let command fmt = Printf.kprintf (fun s -> Sys.command s) fmt
+let command fmt = Printf.kprintf Sys.command fmt
 let must fmt = Printf.kprintf (fun s -> if Sys.command s <> 0 then Exn.failwithf "command %s failed" s) fmt
 let cp = must "/bin/cp %s %s"
 let patch_p1 = must "/bin/patch -p1 < %s"
 val checkenv : string -> bool
   (** check existence of environment variable *)
 
-val command : (int, unit, string, int) format4 -> int
-val must : (unit, unit, string, unit) format4 -> unit
+val command : ('a, unit, string, int) format4 -> 'a
+val must : ('a, unit, string, unit) format4 -> 'a
 val cp : string -> string -> unit
 val patch_p1 : string -> unit