From acf398281c089dd608ae59a7055efea23b86927f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 2 May 2024 16:06:26 +0200 Subject: [PATCH] Fix transport exception not always using 255 exit code, fixes #11954 --- src/Composer/Downloader/TransportException.php | 5 +++++ src/Composer/Installer.php | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/Composer/Downloader/TransportException.php b/src/Composer/Downloader/TransportException.php index c91897c1c..5ab5ca6f3 100644 --- a/src/Composer/Downloader/TransportException.php +++ b/src/Composer/Downloader/TransportException.php @@ -26,6 +26,11 @@ class TransportException extends \RuntimeException /** @var array */ protected $responseInfo = []; + public function __construct(string $message = "", int $code = 400, \Throwable $previous = null) + { + parent::__construct($message, $code, $previous); + } + /** * @param array $headers */ diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 5d7e7fb51..32a149856 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -80,6 +80,8 @@ class Installer // used/declared in SolverProblemsException, carried over here for completeness public const ERROR_DEPENDENCY_RESOLUTION_FAILED = 2; public const ERROR_AUDIT_FAILED = 5; + // technically exceptions are thrown with various status codes >400, but the process exit code is normalized to 255 + public const ERROR_TRANSPORT_EXCEPTION = 255; /** * @var IOInterface