Skip to content

Commit

Permalink
Backport CODE_ERROR constant and return as per expectation.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Jan 19, 2016
1 parent b4960c7 commit c06bde3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/Cake/Console/Shell.php
Expand Up @@ -30,6 +30,13 @@
*/
class Shell extends Object {

/**
* Default error code
*
* @var int
*/
const CODE_ERROR = 1;

/**
* Output constant making verbose shells.
*
Expand Down Expand Up @@ -573,7 +580,8 @@ protected function _getInput($prompt, $options, $default) {
$result = $this->stdin->read();

if ($result === false) {
return $this->_stop(1);
$this->_stop(self::CODE_ERROR);
return self::CODE_ERROR;
}
$result = trim($result);

Expand Down Expand Up @@ -720,7 +728,8 @@ public function error($title, $message = null) {
if (!empty($message)) {
$this->err($message);
}
return $this->_stop(1);
$this->_stop(self::CODE_ERROR);
return self::CODE_ERROR;
}

/**
Expand Down Expand Up @@ -758,7 +767,8 @@ public function createFile($path, $contents) {

if (strtolower($key) === 'q') {
$this->out(__d('cake_console', '<error>Quitting</error>.'), 2);
return $this->_stop();
$this->_stop();
return true;
} elseif (strtolower($key) !== 'y') {
$this->out(__d('cake_console', 'Skip `%s`', $path), 2);
return false;
Expand Down

0 comments on commit c06bde3

Please sign in to comment.