From c3347b8e9cdd256e8f7c465dc781a7d050212f25 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Thu, 4 Jul 2024 15:20:07 +0200 Subject: [PATCH] CLI/WIN * read input as a whole line under WIN instead as stream_get_contents always blocks * fixes #429 --- includes/utilities.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/utilities.php b/includes/utilities.php index eeac4811..99b5a621 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -424,7 +424,8 @@ abstract class CLI if (!$n || !in_array(STDIN, $r)) 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); if ($ordinals[0] == self::CHR_ESC)