From dc9bcd6b452fc41464a9b56d77d840f594f31f75 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 8 Jun 2021 09:14:11 +0200 Subject: [PATCH] Add support for Promises being returned by uninstall in Composer 2.1 --- src/Patches.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Patches.php b/src/Patches.php index 6e23b281..4f77eb3b 100644 --- a/src/Patches.php +++ b/src/Patches.php @@ -124,6 +124,7 @@ public function checkPatches(Event $event) { } // Remove packages for which the patch set has changed. + $promises = array(); foreach ($packages as $package) { if (!($package instanceof AliasPackage)) { $package_name = $package->getName(); @@ -135,10 +136,14 @@ public function checkPatches(Event $event) { || ($has_patches && $has_applied_patches && $tmp_patches[$package_name] !== $extra['patches_applied'])) { $uninstallOperation = new UninstallOperation($package, 'Removing package so it can be re-installed and re-patched.'); $this->io->write('Removing package ' . $package_name . ' so that it can be re-installed and re-patched.'); - $installationManager->uninstall($localRepository, $uninstallOperation); + $promises[] = $installationManager->uninstall($localRepository, $uninstallOperation); } } } + $promises = array_filter($promises); + if ($promises) { + $this->composer->getLoop()->wait($promises); + } } // If the Locker isn't available, then we don't need to do this. // It's the first time packages have been installed.