peridot icon indicating copy to clipboard operation
peridot copied to clipboard

Fix console output under Windows

Open ezzatron opened this issue 8 years ago • 2 comments

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.

ezzatron avatar Nov 28 '16 03:11 ezzatron

+1

Oxicode avatar Apr 24 '18 19:04 Oxicode

Windows 10 character ✓ not work image

Oxicode avatar Apr 24 '18 19:04 Oxicode