From ab6cce26df18a0ad96716ea19db49dc504b6e1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ty=C3=A1s=20Somfai?= Date: Fri, 2 Sep 2016 15:06:50 +0200 Subject: [PATCH] Fixed some issues for the self-update command: added coloring to the rollback message, set return code at general exception handling, fixed an undefined variable notice. --- src/Symfony/Installer/DownloadCommand.php | 1 + src/Symfony/Installer/SelfUpdateCommand.php | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Installer/DownloadCommand.php b/src/Symfony/Installer/DownloadCommand.php index 2ac118d..c3bf3d7 100644 --- a/src/Symfony/Installer/DownloadCommand.php +++ b/src/Symfony/Installer/DownloadCommand.php @@ -520,6 +520,7 @@ protected function getExecutedCommand() } $commandName = $this->getName(); + $commandArguments = ''; if ('new' === $commandName) { $commandArguments = sprintf('%s %s', $this->projectName, ('latest' !== $this->version) ? $this->version : ''); diff --git a/src/Symfony/Installer/SelfUpdateCommand.php b/src/Symfony/Installer/SelfUpdateCommand.php index 0b1810e..28b3890 100644 --- a/src/Symfony/Installer/SelfUpdateCommand.php +++ b/src/Symfony/Installer/SelfUpdateCommand.php @@ -136,6 +136,8 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($this->output->isVeryVerbose()) { $this->output->writeln($e->getMessage()); } + + return 1; } } @@ -148,11 +150,11 @@ private function downloadNewVersion() { // check for permissions in local filesystem before start downloading files if (!is_writable($this->currentInstallerFile)) { - throw new \RuntimeException('Symfony Installer update failed: the "'.$this->currentInstallerFile.'" file could not be written'); + throw new IOException('Symfony Installer update failed: the "'.$this->currentInstallerFile.'" file could not be written'); } if (!is_writable($this->tempDir)) { - throw new \RuntimeException('Symfony Installer update failed: the "'.$this->tempDir.'" directory used to download files temporarily could not be written'); + throw new IOException('Symfony Installer update failed: the "'.$this->tempDir.'" directory used to download files temporarily could not be written'); } if (false === $newInstaller = $this->getUrlContents($this->remoteInstallerFile)) { @@ -225,7 +227,7 @@ private function rollback() { $this->output->writeln(array( '', - 'There was an error while updating the installer.', + 'There was an error while updating the installer.', 'The previous Symfony Installer version has been restored.', '', ));