Skip to content

Commit dc9bcd6

Browse files
authored
Add support for Promises being returned by uninstall in Composer 2.1
1 parent 30707e7 commit dc9bcd6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Patches.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public function checkPatches(Event $event) {
124124
}
125125

126126
// Remove packages for which the patch set has changed.
127+
$promises = array();
127128
foreach ($packages as $package) {
128129
if (!($package instanceof AliasPackage)) {
129130
$package_name = $package->getName();
@@ -135,10 +136,14 @@ public function checkPatches(Event $event) {
135136
|| ($has_patches && $has_applied_patches && $tmp_patches[$package_name] !== $extra['patches_applied'])) {
136137
$uninstallOperation = new UninstallOperation($package, 'Removing package so it can be re-installed and re-patched.');
137138
$this->io->write('<info>Removing package ' . $package_name . ' so that it can be re-installed and re-patched.</info>');
138-
$installationManager->uninstall($localRepository, $uninstallOperation);
139+
$promises[] = $installationManager->uninstall($localRepository, $uninstallOperation);
139140
}
140141
}
141142
}
143+
$promises = array_filter($promises);
144+
if ($promises) {
145+
$this->composer->getLoop()->wait($promises);
146+
}
142147
}
143148
// If the Locker isn't available, then we don't need to do this.
144149
// It's the first time packages have been installed.

0 commit comments

Comments
 (0)