From 083d5a8ed5fb5a3d9ac6969ee85ec9af8f966e3a Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Wed, 11 Jul 2018 23:23:25 +0200 Subject: [PATCH] Don't throw if process already terminated This seems to be a race condition where the close pipe handler hasn't been called, but thee process already died. --- lib/Internal/Posix/Runner.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Internal/Posix/Runner.php b/lib/Internal/Posix/Runner.php index c4f4e7e..19935be 100644 --- a/lib/Internal/Posix/Runner.php +++ b/lib/Internal/Posix/Runner.php @@ -154,7 +154,9 @@ final class Runner implements ProcessRunner } if (!\proc_terminate($handle->proc, 9)) { // Forcefully kill the process using SIGKILL. - throw new ProcessException("Terminating process failed"); + if (\proc_get_status($handle->proc)['running']) { + throw new ProcessException("Terminating process failed"); + } } if ($handle->status < ProcessStatus::ENDED) {