Commits

camlspotter committed 54894d3

Unix.command and others have now different type

Comments (0)

Files changed (1)

       raise e
 ;;
 
-let command cmd f = 
+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 cmd f = 
+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 cmp p1 p2 = 
-  match command ["cmp"; p1; p2] ignore with
+  match command ["cmp"; p1; p2] ~f:ignore with
   | WEXITED 0 -> `Same
   | WEXITED 1 -> `Different
   | WEXITED 2 -> `Error