Skip to content

Commit

Permalink
fix: Show more information upon failure when getting Composer version
Browse files Browse the repository at this point in the history
Related to #1004.
  • Loading branch information
theofidry committed Oct 11, 2023
1 parent b7e493d commit aac4575
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Composer/ComposerOrchestrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ public static function getVersion(
$getVersionProcess->run(null, self::getDefaultEnvVars());

if (false === $getVersionProcess->isSuccessful()) {
throw new RuntimeException(
'Could not determine the Composer version.',
0,
new ProcessFailedException($getVersionProcess),
);
throw new ProcessFailedException($getVersionProcess);
}

$output = $getVersionProcess->getOutput();
Expand All @@ -99,7 +95,12 @@ public static function getVersion(
return $match[1];
}

throw new RuntimeException('Could not determine the Composer version.');
throw new RuntimeException(
sprintf(
'Could not determine the Composer version from "%s".',
$output,
),
);
}

public static function dumpAutoload(
Expand Down

0 comments on commit aac4575

Please sign in to comment.