peridot
peridot copied to clipboard
Fix console output under Windows
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.
+1
Windows 10 character ✓ not work