From aac4575ef8b8e73d1dc6a81b86cec1e011c446d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Wed, 11 Oct 2023 23:51:51 +0200 Subject: [PATCH] fix: Show more information upon failure when getting Composer version Related to #1004. --- src/Composer/ComposerOrchestrator.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Composer/ComposerOrchestrator.php b/src/Composer/ComposerOrchestrator.php index 10f84fc0d..1a5722768 100644 --- a/src/Composer/ComposerOrchestrator.php +++ b/src/Composer/ComposerOrchestrator.php @@ -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(); @@ -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(