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
…#1064)

Related to #1004.
  • Loading branch information
theofidry authored Oct 13, 2023
1 parent 3d7854c commit 6bb9cd2
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 6bb9cd2

Please sign in to comment.