diff --git a/src/Plugin.php b/src/Plugin.php index e656acbb..2c7ff1af 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -164,6 +164,7 @@ public function onDependenciesChangedEvent() { $io = $this->io; $isVerbose = $io->isVerbose(); + $exitCode = 0; if ($isVerbose) { $io->write(sprintf('%s', self::MESSAGE_RUNNING_INSTALLER)); @@ -175,13 +176,18 @@ public function onDependenciesChangedEvent() $installPathUpdated = $this->updateInstalledPaths(); if ($installPathCleaned === true || $installPathUpdated === true) { - $this->saveInstalledPaths(); + $exitCode = $this->saveInstalledPaths(); } elseif ($isVerbose) { $io->write(sprintf('%s', self::MESSAGE_NOTHING_TO_INSTALL)); } - } elseif ($isVerbose) { - $io->write(sprintf('%s', self::MESSAGE_NOT_INSTALLED)); + } else { + $exitCode = 1; + if ($isVerbose) { + $io->write(sprintf('%s', self::MESSAGE_NOT_INSTALLED)); + } } + + exit($exitCode); } /** @@ -218,6 +224,8 @@ private function loadInstalledPaths() * @throws LogicException * @throws ProcessFailedException * @throws RuntimeException + * + * @return int Exit code. 0 for success, 1 or higher for failure. */ private function saveInstalledPaths() { @@ -276,6 +284,8 @@ private function saveInstalledPaths() if ($this->io->isVerbose() && !empty($configResult)) { $this->io->write(sprintf('%s', $configResult)); } + + return $exitCode; } /**