Skip to content

Commit f879244

Browse files
committed
Prevent test case from stalling
If the CTRL-C event can't be sent to the child for whatever reason, the test will never terminate, because `proc_close()` waits for an infinite amount of time. Therefore, we `proc_terminate()` the child instead, after explicitly closing the pipes.
1 parent 678f5b6 commit f879244

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,13 @@ if ($is_child) {
5656
$status = proc_get_status($proc);
5757
if ($status["running"]) {
5858
echo "Child $child_pid didn't exit after ${max}us\n";
59+
foreach ($pipes as $pipe) {
60+
fclose($pipe);
61+
}
62+
proc_terminate($proc);
5963
} else {
6064
echo "Child $child_pid exit with status ", $status["exitcode"], " after ${total}us\n";
6165
}
62-
63-
proc_close($proc);
6466
}
6567

6668
function get_evt_name(int $evt) : ?string

0 commit comments

Comments
 (0)