Skip to content

Commit

Permalink
fix: Fix the ComposerOrchestrator in quiet verbosity (#1087)
Browse files Browse the repository at this point in the history
The verbosity (and ANSI/no-ANSI) of the IO should not inpact those
processes.
  • Loading branch information
theofidry authored Oct 17, 2023
1 parent 1105b7d commit c4a7823
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Composer/ComposerOrchestrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function dumpAutoload(

public function getVendorDir(): string
{
$vendorDirProcess = $this->processFactory->getAutoloadFileProcess();
$vendorDirProcess = $this->processFactory->getVendorDirProcess();

$this->logger->info($vendorDirProcess->getCommandLine());

Expand Down
37 changes: 24 additions & 13 deletions src/Composer/ComposerProcessFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit c4a7823

Please sign in to comment.