From fc59083bdeea178f3c38272de51b499dc2f6c2d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Wed, 18 Oct 2023 00:46:32 +0200 Subject: [PATCH] fix: Fix the ComposerOrchestrator in quiet verbosity The verbosity (and ANSI/no-ANSI) of the IO should not inpact those processes. --- src/Composer/ComposerOrchestrator.php | 2 +- src/Composer/ComposerProcessFactory.php | 37 ++++++++++++++++--------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/Composer/ComposerOrchestrator.php b/src/Composer/ComposerOrchestrator.php index 36677bcbc..4ef305b4c 100644 --- a/src/Composer/ComposerOrchestrator.php +++ b/src/Composer/ComposerOrchestrator.php @@ -131,7 +131,7 @@ public function dumpAutoload( public function getVendorDir(): string { - $vendorDirProcess = $this->processFactory->getAutoloadFileProcess(); + $vendorDirProcess = $this->processFactory->getVendorDirProcess(); $this->logger->info($vendorDirProcess->getCommandLine()); diff --git a/src/Composer/ComposerProcessFactory.php b/src/Composer/ComposerProcessFactory.php index d54169f4c..6afe7c495 100644 --- a/src/Composer/ComposerProcessFactory.php +++ b/src/Composer/ComposerProcessFactory.php @@ -49,12 +49,17 @@ public function __construct( public function getVersionProcess(): Process { - // Never use ANSI support here as we want to parse the raw output. - return $this->createProcess([ - $this->composerExecutable, - '--version', - '--no-ansi', - ]); + return $this->createProcess( + [ + $this->composerExecutable, + '--version', + // Never use ANSI support here as we want to parse the raw output. + '--no-ansi', + ], + // Ensure that even if this command gets executed within the app with --quiet it still + // works. + ['SHELL_VERBOSITY' => 0], + ); } public function getDumpAutoloaderProcess(bool $noDev): Process @@ -76,14 +81,20 @@ public function getDumpAutoloaderProcess(bool $noDev): Process return $this->createProcess($composerCommand); } - public function getAutoloadFileProcess(): Process + public function getVendorDirProcess(): Process { - return $this->createProcess([ - $this->composerExecutable, - 'config', - 'vendor-dir', - '--no-ansi', - ]); + return $this->createProcess( + [ + $this->composerExecutable, + 'config', + 'vendor-dir', + // Never use ANSI support here as we want to parse the raw output. + '--no-ansi', + ], + // Ensure that even if this command gets executed within the app with --quiet it still + // works. + ['SHELL_VERBOSITY' => 0], + ); } private function createProcess(array $command, array $environmentVariables = []): Process