Skip to content

Commit

Permalink
Adding return to Shell::out() and ShellDispatcher::stdout(). They now…
Browse files Browse the repository at this point in the history
… return the number of bytes written to stdout. Fixes #164
  • Loading branch information
markstory committed Oct 17, 2009
1 parent f07df02 commit 2e7a9a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cake/console/cake.php
Expand Up @@ -477,13 +477,14 @@ function getInput($prompt, $options = null, $default = null) {
*
* @param string $string String to output.
* @param boolean $newline If true, the outputs gets an added newline.
* @return integer Returns the number of bytes output to stdout.
* @access public
*/
function stdout($string, $newline = true) {
if ($newline) {
fwrite($this->stdout, $string . "\n");
return fwrite($this->stdout, $string . "\n");
} else {
fwrite($this->stdout, $string);
return fwrite($this->stdout, $string);
}
}

Expand Down
3 changes: 2 additions & 1 deletion cake/console/libs/shell.php
Expand Up @@ -370,13 +370,14 @@ function in($prompt, $options = null, $default = null) {
*
* @param mixed $message A string or a an array of strings to output
* @param integer $newlines Number of newlines to append
* @return integer Returns the number of bytes returned from writing to stdout.
* @access public
*/
function out($message = null, $newlines = 1) {
if (is_array($message)) {
$message = implode($this->nl(), $message);
}
$this->Dispatch->stdout($message . $this->nl($newlines), false);
return $this->Dispatch->stdout($message . $this->nl($newlines), false);
}

/**
Expand Down

0 comments on commit 2e7a9a6

Please sign in to comment.