Skip to content

Commit bfa1cd0

Browse files
committed
enable colors for windows ConEmu user
http://conemu.github.io/ This is used in Cmder for example.
1 parent 2bb3880 commit bfa1cd0

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Console/ConsoleOutput.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,16 @@ class ConsoleOutput
154154
/**
155155
* Construct the output object.
156156
*
157-
* Checks for a pretty console environment. Ansicon allows pretty consoles
158-
* on windows, and is supported.
157+
* Checks for a pretty console environment. Ansicon and ConEmu allows
158+
* pretty consoles on windows, and is supported.
159159
*
160160
* @param string $stream The identifier of the stream to write output to.
161161
*/
162162
public function __construct($stream = 'php://stdout')
163163
{
164164
$this->_output = fopen($stream, 'w');
165165

166-
if ((DS === '\\' && !(bool)env('ANSICON')) ||
166+
if ((DS === '\\' && !(bool)env('ANSICON') && env('ConEmuANSI') !== 'ON') ||
167167
(function_exists('posix_isatty') && !posix_isatty($this->_output))
168168
) {
169169
$this->_outputAs = self::PLAIN;

src/Log/Engine/ConsoleLog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class ConsoleLog extends BaseLog
5757
*/
5858
public function __construct(array $config = [])
5959
{
60-
if ((DS === '\\' && !(bool)env('ANSICON')) ||
60+
if ((DS === '\\' && !(bool)env('ANSICON') && env('ConEmuANSI') !== 'ON') ||
6161
(function_exists('posix_isatty') && !posix_isatty($this->_output))
6262
) {
6363
$this->_defaultConfig['outputAs'] = ConsoleOutput::PLAIN;

tests/TestCase/Log/Engine/ConsoleLogTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function testlogToFileStream()
6868
*/
6969
public function testDefaultOutputAs()
7070
{
71-
if ((DS === '\\' && !(bool)env('ANSICON')) ||
71+
if ((DS === '\\' && !(bool)env('ANSICON') && env('ConEmuANSI') !== 'ON') ||
7272
(function_exists('posix_isatty') && !posix_isatty(null))
7373
) {
7474
$expected = ConsoleOutput::PLAIN;

0 commit comments

Comments
 (0)