From 5a1d506c77c7e182a90f76ce011e2fc5b7ba7f14 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 20 Mar 2024 10:47:52 +0100 Subject: [PATCH] Fix composer status command handling of failed promises, closes #11889 --- src/Composer/Downloader/FileDownloader.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index 2a2847f33..b128c8a79 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -495,10 +495,22 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface $this->filesystem->removeDirectory($targetDir.'_compare'); } - $this->download($package, $targetDir.'_compare', null, false); + $promise = $this->download($package, $targetDir.'_compare', null, false); + $promise->catch(function ($ex) use (&$e) { + $e = $ex; + }); $this->httpDownloader->wait(); - $this->install($package, $targetDir.'_compare', false); + if ($e !== null) { + throw $e; + } + $promise = $this->install($package, $targetDir.'_compare', false); + $promise->catch(function ($ex) use (&$e) { + $e = $ex; + }); $this->process->wait(); + if ($e !== null) { + throw $e; + } $comparer = new Comparer(); $comparer->setSource($targetDir.'_compare'); @@ -511,7 +523,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface $this->io = $prevIO; - if ($e) { + if ($e !== null) { throw $e; }