Skip to content

Commit e404b85

Browse files
committed
fixup! Windows safe kill.
1 parent 90b5d71 commit e404b85

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

lib/olly_common/launch.ml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ external is_process_alive : int -> bool = "olly_is_process_alive"
55
On Unix it's the identity function since the handle IS the PID. *)
66
external get_process_id : int -> int = "olly_get_process_id"
77

8-
(* Windows has no SIGKILL — Unix.kill only routes SIGTERM through
9-
TerminateProcess. On Unix we want SIGKILL because some test programs
10-
(e.g. tight integer loops) never reach a signal-poll point and so
11-
ignore SIGTERM. *)
12-
let terminate_signal = if Sys.win32 then Sys.sigterm else Sys.sigkill
13-
148
let lost_events ring_id num =
159
Printf.eprintf "[ring_id=%d] Lost %d events\n%!" ring_id num
1610

@@ -101,7 +95,7 @@ let exec_process (config : runtime_events_config) (args : string list) :
10195
the kill didn't take for any reason, hanging the test suite for
10296
hours is worse than reporting and moving on. *)
10397
let kill () =
104-
(try Unix.kill child_pid terminate_signal
98+
(try Unix.kill child_pid Sys.sigkill
10599
with Unix.Unix_error _ | Invalid_argument _ -> ());
106100
let deadline = Unix.gettimeofday () +. 5.0 in
107101
let rec wait () =
@@ -196,7 +190,7 @@ let attach_process (dir : string) (pid : int) : subprocess =
196190
waitpid on. Send the platform terminate signal and poll
197191
is_process_alive briefly. *)
198192
let kill () =
199-
(try Unix.kill pid terminate_signal
193+
(try Unix.kill pid Sys.sigkill
200194
with Unix.Unix_error _ | Invalid_argument _ -> ());
201195
let deadline = Unix.gettimeofday () +. 2.0 in
202196
while is_process_alive pid && Unix.gettimeofday () < deadline do

0 commit comments

Comments
 (0)