mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
CLI/WIN
* read input as a whole line under WIN instead as stream_get_contents always blocks * fixes #429
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user