aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2016-03-09 17:43:12 +0100
committerPierre-Marie Pédrot2016-03-09 17:43:12 +0100
commitfdbad8894dec9df0294e91aac61ce47d5af609d4 (patch)
tree9606652bb2c7016c6087c6238a06ed756d460293 /lib
parentc633bb322acf0bb626eafe6158287d1ddc11af26 (diff)
parent2788c86e6a3c089aa7450a7768f8444470e35901 (diff)
Merge branch 'v8.5'
Diffstat (limited to 'lib')
-rw-r--r--lib/spawn.ml22
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/spawn.ml b/lib/spawn.ml
index 4d35ded90f..fda4b4239a 100644
--- a/lib/spawn.ml
+++ b/lib/spawn.ml
@@ -220,10 +220,13 @@ let stats { oob_req; oob_resp; alive } =
input_value oob_resp
let rec wait p =
- try snd (Unix.waitpid [] p.pid)
- with
- | Unix.Unix_error (Unix.EINTR, _, _) -> wait p
- | Unix.Unix_error _ -> Unix.WEXITED 0o400
+ (* On windows kill is not reliable, so wait may never return. *)
+ if Sys.os_type = "Unix" then
+ try snd (Unix.waitpid [] p.pid)
+ with
+ | Unix.Unix_error (Unix.EINTR, _, _) -> wait p
+ | Unix.Unix_error _ -> Unix.WEXITED 0o400
+ else Unix.WEXITED 0o400
end
@@ -267,8 +270,13 @@ let stats { oob_req; oob_resp; alive } =
flush oob_req;
let RespStats g = input_value oob_resp in g
-let wait { pid = unixpid } =
- try snd (Unix.waitpid [] unixpid)
- with Unix.Unix_error _ -> Unix.WEXITED 0o400
+let rec wait p =
+ (* On windows kill is not reliable, so wait may never return. *)
+ if Sys.os_type = "Unix" then
+ try snd (Unix.waitpid [] p.pid)
+ with
+ | Unix.Unix_error (Unix.EINTR, _, _) -> wait p
+ | Unix.Unix_error _ -> Unix.WEXITED 0o400
+ else Unix.WEXITED 0o400
end