Skip to content

Commit

Permalink
fix: Get the raw output for the Composer version (#1063)
Browse files Browse the repository at this point in the history
I suspect in some context the current `ComposerOrchestrator::getVersion()` could get the ANSI output for which the regex we use afterwards to extract the Composer version does not work. Rather than fixing the regex which is not trivial, it makes more sense to guarantee a no-ANSI output.

Fixes #1004.
  • Loading branch information
theofidry authored Oct 13, 2023
1 parent b7e493d commit 3d7854c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Composer/ComposerOrchestrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function getVersion(
$logger = new CompilerLogger($io ?? IO::createNull());

$composerExecutable = $composerBin ?? self::retrieveComposerExecutable();
$getVersionProcess = new Process([$composerExecutable, '--version']);
$getVersionProcess = new Process([$composerExecutable, '--version', '--no-ansi']);

$logger->log(
CompilerLogger::CHEVRON_PREFIX,
Expand Down
4 changes: 2 additions & 2 deletions tests/Console/Command/CompileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ public function test_it_can_build_a_phar_file_in_verbose_mode(): void
? Removing the existing PHAR "/path/to/tmp/test.phar"
? Checking Composer compatibility
> '/usr/local/bin/composer' '--version'
> '/usr/local/bin/composer' '--version' '--no-ansi'
> 2.5.0 (Box requires ^2.2.0)
> Supported version detected
? Registering compactors
Expand Down Expand Up @@ -986,7 +986,7 @@ public function test_it_can_build_a_phar_file_in_very_verbose_mode(): void
? Removing the existing PHAR "/path/to/tmp/test.phar"
? Checking Composer compatibility
> '/usr/local/bin/composer' '--version'
> '/usr/local/bin/composer' '--version' '--no-ansi'
> 2.5.0 (Box requires ^2.2.0)
> Supported version detected
? Registering compactors
Expand Down

0 comments on commit 3d7854c

Please sign in to comment.