Skip to content

Commit 96aca96

Browse files
committed
CliRunner: fixed reading of big stdout (closes #69)
1 parent 47d4c21 commit 96aca96

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Runners/CliRunner.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,21 @@ public function run($cwd, array $args, array $env = NULL)
5353
}
5454

5555
// Reset output and error
56+
stream_set_blocking($pipes[1], false);
57+
stream_set_blocking($pipes[2], false);
5658
$stdout = '';
5759
$stderr = '';
5860

5961
while (TRUE) {
6062
// Read standard output
61-
$stdoutOutput = fgets($pipes[1], 1024);
63+
$stdoutOutput = stream_get_contents($pipes[1]);
6264

6365
if (is_string($stdoutOutput)) {
6466
$stdout .= $stdoutOutput;
6567
}
6668

6769
// Read error output
68-
$stderrOutput = fgets($pipes[2], 1024);
70+
$stderrOutput = stream_get_contents($pipes[2]);
6971

7072
if (is_string($stderrOutput)) {
7173
$stderr .= $stderrOutput;

0 commit comments

Comments
 (0)