From 595c4c6f7526cb7227e584b7219b30c0c0c41cba Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 13 Nov 2020 14:50:24 +0100 Subject: [PATCH] Make sure we handle cases where STDIN/STDOUT may not be defined --- src/Composer/Console/Application.php | 2 +- src/Composer/Util/Platform.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index e92b45863..762425272 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -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); } diff --git a/src/Composer/Util/Platform.php b/src/Composer/Util/Platform.php index a582a6fad..72396f0a7 100644 --- a/src/Composer/Util/Platform.php +++ b/src/Composer/Util/Platform.php @@ -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