diff --git a/lib/Cake/Console/ShellDispatcher.php b/lib/Cake/Console/ShellDispatcher.php index 899df3b91b6..d2f1bc16e8e 100644 --- a/lib/Cake/Console/ShellDispatcher.php +++ b/lib/Cake/Console/ShellDispatcher.php @@ -125,9 +125,7 @@ protected function _bootstrap() { * @return integer The cli command exit code. 0 is success. */ public function dispatch() { - $exit = 0; - $this->_dispatch(); - return $exit; + return $this->_dispatch() === true ? 0 : 1; } /** @@ -160,6 +158,7 @@ protected function _dispatch() { $Shell->loadTasks(); return $Shell->runCommand($command, $this->args); } + $methods = array_diff(get_class_methods($Shell), get_class_methods('Cake\Console\Shell')); $added = in_array($command, $methods); $private = $command[0] === '_' && method_exists($Shell, $command);