peridot-php / peridot

Event driven BDD test framework for PHP
http://peridot-php.github.io/
MIT License
328 stars 27 forks source link

Fix console output under Windows #195

Closed ezzatron closed 2 months ago

ezzatron commented 7 years ago

Relates to #192.

For reference, this is the logic I use in Phony to check for ANSI support:

            'stdout.ansi' => function () {
                // @codeCoverageIgnoreStart
                if (DIRECTORY_SEPARATOR === '\\') {
                    return
                        0 >= version_compare(
                        '10.0.10586',
                        PHP_WINDOWS_VERSION_MAJOR .
                            '.' . PHP_WINDOWS_VERSION_MINOR .
                            '.' . PHP_WINDOWS_VERSION_BUILD
                        ) ||
                        false !== getenv('ANSICON') ||
                        'ON' === getenv('ConEmuANSI') ||
                        'xterm' === getenv('TERM') ||
                        false !== getenv('BABUN_HOME');
                }
                // @codeCoverageIgnoreEnd
                return function_exists('posix_isatty') && @posix_isatty(STDOUT);
            },

^ This is borrowed from Symfony Console I believe. It's a bit messy, but adds support for various Windows console replacements that have ANSI support.

It also seems like the tick () character isn't working so great in some cases. Needs more research.

Oxicode commented 6 years ago

+1

Oxicode commented 6 years ago

Windows 10 character ✓ not work image