Skip to content

Commit d0a9cc8

Browse files
committed
Fix Symfony Console incompatibility with Amphp
1 parent ea11dfa commit d0a9cc8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Cli/IO.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ private static function safeWrite(string|array $messages): void
216216
$messages = explode(PHP_EOL, $messages);
217217
}
218218

219+
// Symfony `StreamOutput` is not compatible with non-blocking mode
220+
// (in that case `fwrite` returns the number of bytes written, which Symfony ignores)
221+
// Amphp sets STDOUT and STDERR to non-blocking mode, so we need to set them back to blocking mode here.
222+
stream_set_blocking(STDOUT, true);
223+
stream_set_blocking(STDERR, true);
224+
219225
self::$output->writeln($messages);
220226

221227
// Render the spinner again

0 commit comments

Comments
 (0)