Description
This is a follow-up to #33980 which was closed as fixed by #47935, but only for Unix/Linux, because Unix and Windows use a different PAL for the tail end of console. The ultimate feature was enabling a new environmental variable: DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION
, which when set to 1
or true
will still emit color codes when the console is redirected (e.g. under CI conditions for logging).
Here's the Unix PAL implementation (also respecting NO_COLOR
):
And here's the Windows PAL: https://github.com/dotnet/runtime/blob/ed04fef3b744ad179f4c570b873721d09534c017/src/libraries/System.Console/src/System/ConsolePal.Windows.cs
Having color output in environments like GitHub Actions is immensely helpful when finding errors in massive logs for example, compare these Unix and Windows runs today (here's an example PR, though the logs will likely expire long-term):
The ask is: can we please make DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION
work on Windows as well?