ut icon indicating copy to clipboard operation
ut copied to clipboard

Print no ANSI escape chars if the target isn't terminal

Open zhihaoy opened this issue 3 years ago • 1 comments

Expected Behavior

Print black/white text if the target isn't terminal

Actual Behavior

This is Visual Studio's WSL Dumb Console output:

image

isatty can do the job. To be more accurate, you can consider switching from iostreams to stdio, and use fileno on stdout.

zhihaoy avatar Feb 12 '22 10:02 zhihaoy

Examples: doctest: https://github.com/doctest/doctest/blob/7b9885133108ae301ddd16e2651320f54cafeba7/doctest/doctest.h#L4125-L4127 catch2: https://github.com/catchorg/Catch2/blob/efb54926eec28900e020131930b35116075f6f84/src/catch2/internal/catch_console_colour.cpp#L173-L177

zhihaoy avatar Feb 12 '22 10:02 zhihaoy