1
0
Fork 0

Avoid opening php://stdin multiple times, fixes #12107

pull/12110/head
Jordi Boggiano 2024-09-17 09:47:20 +02:00
parent 1b5b56f234
commit 3e7b826904
No known key found for this signature in database
1 changed files with 4 additions and 1 deletions

View File

@ -153,7 +153,10 @@ class Application extends BaseApplication
$this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins'); $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
$this->disableScriptsByDefault = $input->hasParameterOption('--no-scripts'); $this->disableScriptsByDefault = $input->hasParameterOption('--no-scripts');
static $stdin = null;
if (null === $stdin) {
$stdin = defined('STDIN') ? STDIN : fopen('php://stdin', 'r'); $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))) { if (Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING') !== '1' && (Platform::getEnv('COMPOSER_NO_INTERACTION') || $stdin === false || !Platform::isTty($stdin))) {
$input->setInteractive(false); $input->setInteractive(false);
} }