1
0
Fork 0

Make sure we handle cases where STDIN/STDOUT may not be defined

pull/9478/head
Jordi Boggiano 2020-11-13 14:50:24 +01:00
parent 8936f724d4
commit 595c4c6f75
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 2 additions and 2 deletions

View File

@ -129,7 +129,7 @@ class Application extends BaseApplication
{
$this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
if (getenv('COMPOSER_NO_INTERACTION') || !Platform::isTty(STDIN)) {
if (getenv('COMPOSER_NO_INTERACTION') || !Platform::isTty(defined('STDIN') ? STDIN : fopen('php://stdin', 'r'))) {
$input->setInteractive(false);
}

View File

@ -93,7 +93,7 @@ class Platform
public static function isTty($fd = null)
{
if ($fd === null) {
$fd = STDOUT;
$fd = defined('STDOUT') ? STDOUT : fopen('php://stdout', 'w');
}
// modern cross-platform function, includes the fstat