Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 3cccfc5ff56b882a890587aad1c2cab772b39fd6 Mon Sep 17 00:00:00 2001
- From: Jeremie Dimino <jdimino@janestreet.com>
- Date: Fri, 15 Mar 2013 16:58:46 +0000
- Subject: [PATCH] handle EINTR in Unix.system
- ---
- otherlibs/unix/unix.ml | 10 +++++-----
- 1 files changed, 5 insertions(+), 5 deletions(-)
- diff --git a/otherlibs/unix/unix.ml b/otherlibs/unix/unix.ml
- index 8e573d8..8a69ca7 100644
- --- a/otherlibs/unix/unix.ml
- +++ b/otherlibs/unix/unix.ml
- @@ -837,6 +837,10 @@ 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
- @@ -844,7 +848,7 @@ let system 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;
- --
- 1.7.1
Add Comment
Please, Sign In to add comment