* read input as a whole line under WIN instead as stream_get_contents always blocks
 * fixes #429
This commit is contained in:
Sarjuuk
2024-07-04 15:20:07 +02:00
parent cd4e049680
commit c3347b8e9c

View File

@@ -424,7 +424,8 @@ abstract class CLI
if (!$n || !in_array(STDIN, $r)) if (!$n || !in_array(STDIN, $r))
continue; continue;
$chars = str_split(stream_get_contents(STDIN)); // stream_get_contents is always blocking under WIN - fgets should work similary as php always receives a terminated line of text
$chars = str_split(OS_WIN ? fgets(STDIN) : stream_get_contents(STDIN));
$ordinals = array_map('ord', $chars); $ordinals = array_map('ord', $chars);
if ($ordinals[0] == self::CHR_ESC) if ($ordinals[0] == self::CHR_ESC)