CLI/readline
* added checks if STDIN is available and open before accessing it.
This commit is contained in:
parent
9bb5afd9a7
commit
10de320616
1 changed files with 6 additions and 0 deletions
|
|
@ -383,6 +383,9 @@ abstract class CLI
|
|||
if (self::$hasReadline)
|
||||
readline_callback_handler_install('', function() { });
|
||||
|
||||
if (!STDIN)
|
||||
return false;
|
||||
|
||||
stream_set_blocking(STDIN, false);
|
||||
|
||||
// pad default values onto $fields
|
||||
|
|
@ -396,6 +399,9 @@ abstract class CLI
|
|||
echo "\n".$desc.": ";
|
||||
|
||||
while (true) {
|
||||
if (feof(STDIN))
|
||||
return false;
|
||||
|
||||
$r = [STDIN];
|
||||
$w = $e = null;
|
||||
$n = stream_select($r, $w, $e, 200000);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue