mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Initial integration of ConsoleOutput into cake console tools.
This commit is contained in:
parent
5c55c289f7
commit
ce4fe64a61
2 changed files with 7 additions and 9 deletions
|
@ -17,6 +17,8 @@
|
||||||
* @since CakePHP(tm) v 2.0
|
* @since CakePHP(tm) v 2.0
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
require_once 'console_output.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shell dispatcher handles dispatching cli commands.
|
* Shell dispatcher handles dispatching cli commands.
|
||||||
*
|
*
|
||||||
|
@ -174,8 +176,8 @@ class ShellDispatcher {
|
||||||
*/
|
*/
|
||||||
protected function _initEnvironment() {
|
protected function _initEnvironment() {
|
||||||
$this->stdin = fopen('php://stdin', 'r');
|
$this->stdin = fopen('php://stdin', 'r');
|
||||||
$this->stdout = fopen('php://stdout', 'w');
|
$this->stdout = new ConsoleOutput('php://stdout');
|
||||||
$this->stderr = fopen('php://stderr', 'w');
|
$this->stderr = new ConsoleOutput('php://stderr');
|
||||||
|
|
||||||
if (!$this->__bootstrap()) {
|
if (!$this->__bootstrap()) {
|
||||||
$this->stderr("\nCakePHP Console: ");
|
$this->stderr("\nCakePHP Console: ");
|
||||||
|
@ -454,11 +456,7 @@ class ShellDispatcher {
|
||||||
* @return integer Returns the number of bytes output to stdout.
|
* @return integer Returns the number of bytes output to stdout.
|
||||||
*/
|
*/
|
||||||
public function stdout($string, $newline = true) {
|
public function stdout($string, $newline = true) {
|
||||||
if ($newline) {
|
return $this->stdout->write($string, $newline);
|
||||||
return fwrite($this->stdout, $string . "\n");
|
|
||||||
} else {
|
|
||||||
return fwrite($this->stdout, $string);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -467,7 +465,7 @@ class ShellDispatcher {
|
||||||
* @param string $string Error text to output.
|
* @param string $string Error text to output.
|
||||||
*/
|
*/
|
||||||
public function stderr($string) {
|
public function stderr($string) {
|
||||||
fwrite($this->stderr, $string);
|
$this->stderr->write($string, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue