Permalink
Browse files

Fix PR#5953

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13421 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information...
1 parent 677f402 commit 4b625179f59ddb85f3b96e4816a29c47d3ce14b6 @diml diml committed Mar 22, 2013
Showing with 5 additions and 5 deletions.
  1. +5 −5 otherlibs/unix/unix.ml
View
@@ -837,14 +837,18 @@ external setsid : unit -> int = "unix_setsid"
(* High-level process management (system, popen) *)
+let rec waitpid_non_intr pid =
+ try waitpid [] pid
+ with Unix_error (EINTR, _, _) -> waitpid_non_intr pid
+
let system cmd =
match fork() with
0 -> begin try
execv "/bin/sh" [| "/bin/sh"; "-c"; cmd |]
with _ ->
exit 127
end
- | id -> snd(waitpid [] id)
+ | id -> snd(waitpid_non_intr id)
let rec safe_dup fd =
let new_fd = dup fd in
@@ -997,10 +1001,6 @@ let find_proc_id fun_name proc =
with Not_found ->
raise(Unix_error(EBADF, fun_name, ""))
-let rec waitpid_non_intr pid =
- try waitpid [] pid
- with Unix_error (EINTR, _, _) -> waitpid_non_intr pid
-
let close_process_in inchan =
let pid = find_proc_id "close_process_in" (Process_in inchan) in
close_in inchan;

0 comments on commit 4b62517

Please sign in to comment.