From 8f7597da22eb19afa562568b08fb4ac920fa7c64 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 22 Feb 2021 13:42:38 +0100 Subject: [PATCH] Use a different way to suppress output than changing output verbosity in exec command, fixes #9711 --- src/Composer/Command/ExecCommand.php | 3 --- src/Composer/EventDispatcher/EventDispatcher.php | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Composer/Command/ExecCommand.php b/src/Composer/Command/ExecCommand.php index fba9e7e8a..167a2be0d 100644 --- a/src/Composer/Command/ExecCommand.php +++ b/src/Composer/Command/ExecCommand.php @@ -88,9 +88,6 @@ EOT $dispatcher = $composer->getEventDispatcher(); $dispatcher->addListener('__exec_command', $binary); - if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) { - $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); - } // If the CWD was modified, we restore it to what it was initially, as it was // most likely modified by the global command, and we want exec to run in the local working directory diff --git a/src/Composer/EventDispatcher/EventDispatcher.php b/src/Composer/EventDispatcher/EventDispatcher.php index 882b160e2..9264d7f4a 100644 --- a/src/Composer/EventDispatcher/EventDispatcher.php +++ b/src/Composer/EventDispatcher/EventDispatcher.php @@ -226,7 +226,8 @@ class EventDispatcher $exec = $callable . ($args === '' ? '' : ' '.$args); if ($this->io->isVerbose()) { $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec)); - } else { + } elseif ($event->getName() !== '__exec_command') { + // do not output the command being run when using `composer exec` as it is fairly obvious the user is running it $this->io->writeError(sprintf('> %s', $exec)); }