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

main
Jordi Boggiano 4 years ago
parent 8936f724d4
commit 595c4c6f75
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -129,7 +129,7 @@ class Application extends BaseApplication
{ {
$this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins'); $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); $input->setInteractive(false);
} }

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

Loading…
Cancel
Save