From dd54f295fe859dd76e330994d54a86570f0dc89d Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 17 May 2021 22:34:32 +0200 Subject: [PATCH] Fix progress output, and remove progress bar on CI env, fixes #9621, closes #9880 --- src/Composer/Installer/InstallationManager.php | 12 +++++++++++- src/Composer/Util/Loop.php | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Composer/Installer/InstallationManager.php b/src/Composer/Installer/InstallationManager.php index 6b42dd8ed..bde96e73a 100644 --- a/src/Composer/Installer/InstallationManager.php +++ b/src/Composer/Installer/InstallationManager.php @@ -451,12 +451,22 @@ class InstallationManager private function waitOnPromises(array $promises) { $progress = null; - if ($this->outputProgress && $this->io instanceof ConsoleIO && !$this->io->isDebug() && count($promises) > 1) { + if ( + $this->outputProgress + && $this->io instanceof ConsoleIO + && !getenv('CI') + && !$this->io->isDebug() + && count($promises) > 1 + ) { $progress = $this->io->getProgressBar(); } $this->loop->wait($promises, $progress); if ($progress) { $progress->clear(); + // ProgressBar in non-decorated output does not output a final line-break and clear() does nothing + if ($this->io->isDecorated()) { + $this->io->writeError(''); + } } } diff --git a/src/Composer/Util/Loop.php b/src/Composer/Util/Loop.php index 2e29b563f..eb6461a33 100644 --- a/src/Composer/Util/Loop.php +++ b/src/Composer/Util/Loop.php @@ -108,7 +108,7 @@ class Loop // as we skip progress updates if they are too quick, make sure we do one last one here at 100% if ($progress) { - $progress->setProgress($progress->getMaxSteps()); + $progress->finish(); } unset($this->currentPromises[$waitIndex]);