diff --git a/src/Composer/Installer/PluginInstaller.php b/src/Composer/Installer/PluginInstaller.php index 14aec4462..3eaa62b0d 100644 --- a/src/Composer/Installer/PluginInstaller.php +++ b/src/Composer/Installer/PluginInstaller.php @@ -59,7 +59,14 @@ class PluginInstaller extends LibraryInstaller } parent::install($repo, $package); - $this->composer->getPluginManager()->registerPackage($package, true); + try { + $this->composer->getPluginManager()->registerPackage($package, true); + } catch(\Exception $e) { + // Rollback installation + $this->io->writeError('Plugin installation failed, rolling back'); + parent::uninstall($repo, $package); + throw $e; + } } /**