From ae785225fa347806ca63df3337d73796e3963ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Monta=C3=B1ez?= Date: Sun, 16 Mar 2014 13:31:36 -0300 Subject: [PATCH] Issue #43 - Exit code should indicate that something failed. --- Mage/Console.php | 5 +++++ bin/mage | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Mage/Console.php b/Mage/Console.php index 7436de3..4c5e0a2 100644 --- a/Mage/Console.php +++ b/Mage/Console.php @@ -67,6 +67,8 @@ class Console */ public function run($arguments) { + $exitCode = 10; + // Declare a Shutdown Closure register_shutdown_function(function() { // Only Unlock if there was an error @@ -120,6 +122,7 @@ class Console } } $command->run(); + $exitCode = 0; } catch (Exception $exception) { self::output('' . $exception->getMessage() . '', 1, 2); @@ -135,6 +138,8 @@ class Console // Check if logs need to be deleted self::checkLogs($config); + + return $exitCode; } /** diff --git a/bin/mage b/bin/mage index fb9c558..845e251 100755 --- a/bin/mage +++ b/bin/mage @@ -26,4 +26,6 @@ array_shift($argv); // Run Magallanes $console = new Mage\Console; -$console->run($argv); +$exitCode = $console->run($argv); + +exit($exitCode);