From 96aca963dd753cc30c6f1a30fb9e6224b7ff21a7 Mon Sep 17 00:00:00 2001 From: Jan Pecha Date: Sun, 9 May 2021 12:09:00 +0200 Subject: [PATCH] CliRunner: fixed reading of big stdout (closes #69) --- src/Runners/CliRunner.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Runners/CliRunner.php b/src/Runners/CliRunner.php index 7bd73a2..da9c48a 100644 --- a/src/Runners/CliRunner.php +++ b/src/Runners/CliRunner.php @@ -53,19 +53,21 @@ public function run($cwd, array $args, array $env = NULL) } // Reset output and error + stream_set_blocking($pipes[1], false); + stream_set_blocking($pipes[2], false); $stdout = ''; $stderr = ''; while (TRUE) { // Read standard output - $stdoutOutput = fgets($pipes[1], 1024); + $stdoutOutput = stream_get_contents($pipes[1]); if (is_string($stdoutOutput)) { $stdout .= $stdoutOutput; } // Read error output - $stderrOutput = fgets($pipes[2], 1024); + $stderrOutput = stream_get_contents($pipes[2]); if (is_string($stderrOutput)) { $stderr .= $stderrOutput;