diff --git a/cake/console/console_output.php b/cake/console/console_output.php index 424df97cd..dd00f49e4 100644 --- a/cake/console/console_output.php +++ b/cake/console/console_output.php @@ -50,6 +50,13 @@ class ConsoleOutput { */ protected $_output; +/** + * Is set to true for consoles that can take pretty output. (Not windows). + * + * @var boolean + */ + protected $_prettyOutput = true; + /** * Constant for a newline. */ @@ -115,10 +122,17 @@ class ConsoleOutput { /** * Construct the output object. * + * Checks for a pretty console enviornment. Ansicon allows pretty consoles + * on windows, and is supported. + * * @return void */ public function __construct($stream = 'php://stdout') { $this->_output = fopen($stream, 'w'); + + if (DS == '\\') { + $this->_prettyOutput = (bool)env('ANSICON'); + } } /** @@ -143,6 +157,9 @@ class ConsoleOutput { * @return string String with color codes added. */ public function styleText($text) { + if (!$this->_prettyOutput) { + return strip_tags($text); + } return preg_replace_callback( '/<(?[a-z0-9-_]+)>(?.*)<\/(\1)>/i', array($this, '_replaceTags'), $text );