diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 64166a982..3a784f8a8 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -153,7 +153,10 @@ class Application extends BaseApplication $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins'); $this->disableScriptsByDefault = $input->hasParameterOption('--no-scripts'); - $stdin = defined('STDIN') ? STDIN : fopen('php://stdin', 'r'); + static $stdin = null; + if (null === $stdin) { + $stdin = defined('STDIN') ? STDIN : fopen('php://stdin', 'r'); + } if (Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING') !== '1' && (Platform::getEnv('COMPOSER_NO_INTERACTION') || $stdin === false || !Platform::isTty($stdin))) { $input->setInteractive(false); }