Skip to content

Commit

Permalink
DSWM-11847 Resolve uninstall promise before fire the POST_PACKAGE_UNI…
Browse files Browse the repository at this point in the history
…NSTALL event where preserve-paths restore the files
  • Loading branch information
Juan M. Sosso committed Oct 23, 2024
1 parent 6f426f9 commit 8a2448a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Patches.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ 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();
Expand All @@ -152,7 +151,8 @@ public function checkPatches(Event $event) {
$uninstallOperation
);

$promises[] = $installationManager->uninstall($localRepository, $uninstallOperation);
$uninstallPromise = $installationManager->uninstall($localRepository, $uninstallOperation);
$this->composer->getLoop()->wait([$uninstallPromise]);

$this->eventDispatcher->dispatchPackageEvent(
PackageEvents::POST_PACKAGE_UNINSTALL,
Expand All @@ -164,10 +164,6 @@ public function checkPatches(Event $event) {
}
}
}
$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.
Expand Down

0 comments on commit 8a2448a

Please sign in to comment.