Skip to content

Use ANSI colors for forced output without a Windows console - #5091

Open
Tiancheng-Xu wants to merge 2 commits into
google:mainfrom
Tiancheng-Xu:fix/2930-windows-forced-color
Open

Tiancheng-Xu wants to merge 2 commits into
google:mainfrom
Tiancheng-Xu:fix/2930-windows-forced-color

Conversation

@Tiancheng-Xu

Copy link
Copy Markdown

Fixes #2930

Summary

  • Add a Windows regression test covering both --gtest_color=yes and GTEST_COLOR=yes when stdout is captured through a pipe.
  • Fall back to ANSI color sequences only when color is explicitly forced and GetConsoleScreenBufferInfo() cannot use the stdout handle.
  • Preserve the existing auto and no behavior and do not add a public ansi option.

Validation

  • cmake --build build -j2
  • ctest --test-dir build --output-on-failure (45/45 passed on macOS)
  • git diff --check
  • Windows-specific regression is included for CI validation.

This change was prepared with AI assistance and reviewed against the repository contribution guidelines.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Question: Colored output on Windows powershell with CTest

1 participant