浏览代码

Merge pull request #7090 from antograssiot/conEmu

enable colors for windows ConEmu user
Mark Story 10 年之前
父节点
当前提交
fa54940231
共有 3 个文件被更改,包括 5 次插入5 次删除
  1. 3 3
      src/Console/ConsoleOutput.php
  2. 1 1
      src/Log/Engine/ConsoleLog.php
  3. 1 1
      tests/TestCase/Log/Engine/ConsoleLogTest.php

+ 3 - 3
src/Console/ConsoleOutput.php

@@ -154,8 +154,8 @@ class ConsoleOutput
     /**
      * Construct the output object.
      *
-     * Checks for a pretty console environment. Ansicon allows pretty consoles
-     * on windows, and is supported.
+     * Checks for a pretty console environment. Ansicon and ConEmu allows
+     *  pretty consoles on windows, and is supported.
      *
      * @param string $stream The identifier of the stream to write output to.
      */
@@ -163,7 +163,7 @@ class ConsoleOutput
     {
         $this->_output = fopen($stream, 'w');
 
-        if ((DS === '\\' && !(bool)env('ANSICON')) ||
+        if ((DS === '\\' && !(bool)env('ANSICON') && env('ConEmuANSI') !== 'ON') ||
             (function_exists('posix_isatty') && !posix_isatty($this->_output))
         ) {
             $this->_outputAs = self::PLAIN;

+ 1 - 1
src/Log/Engine/ConsoleLog.php

@@ -57,7 +57,7 @@ class ConsoleLog extends BaseLog
      */
     public function __construct(array $config = [])
     {
-        if ((DS === '\\' && !(bool)env('ANSICON')) ||
+        if ((DS === '\\' && !(bool)env('ANSICON') && env('ConEmuANSI') !== 'ON') ||
             (function_exists('posix_isatty') && !posix_isatty($this->_output))
         ) {
             $this->_defaultConfig['outputAs'] = ConsoleOutput::PLAIN;

+ 1 - 1
tests/TestCase/Log/Engine/ConsoleLogTest.php

@@ -68,7 +68,7 @@ class ConsoleLogTest extends TestCase
      */
     public function testDefaultOutputAs()
     {
-        if ((DS === '\\' && !(bool)env('ANSICON')) ||
+        if ((DS === '\\' && !(bool)env('ANSICON') && env('ConEmuANSI') !== 'ON') ||
             (function_exists('posix_isatty') && !posix_isatty(null))
         ) {
             $expected = ConsoleOutput::PLAIN;