From 843d5a21be68cce6198c56be1cb9b04d8995ab76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Fri, 22 Apr 2022 12:01:03 +0000 Subject: [PATCH] PR review changes --- src/CLI/Console.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/CLI/Console.php b/src/CLI/Console.php index f994415..921b1e8 100644 --- a/src/CLI/Console.php +++ b/src/CLI/Console.php @@ -144,7 +144,7 @@ static public function execute(string $cmd, string $stdin, string &$stdout, stri $start = \time(); $stdout = ''; $stderr = ''; - $statusPipe = ''; + $status = ''; if (\is_resource($process)) { \stream_set_blocking($pipes[0], false); @@ -159,21 +159,19 @@ static public function execute(string $cmd, string $stdin, string &$stdout, stri while (\is_resource($process)) { $stdout .= \stream_get_contents($pipes[1]); $stderr .= \stream_get_contents($pipes[2]); - $statusPipe .= \stream_get_contents($pipes[3]); + $status .= \stream_get_contents($pipes[3]); if ($timeout > 0 && \time() - $start > $timeout) { \proc_terminate($process, 9); return 1; } - $status = \proc_get_status($process); - - if (!$status['running']) { + if (!\proc_get_status($process)['running']) { \fclose($pipes[1]); \fclose($pipes[2]); \proc_close($process); - $exitCode = (int) str_replace("\n","",$statusPipe); + $exitCode = (int) str_replace("\n","",$status); return $exitCode; }