catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
Don't use console colour if running in XCode
- Commit
54f1ce2af287c85e88eff6813d3bc107a8e0c576- Author
- Phil Nash ·
- Parents
0a146e3af7df
Changes
include/internal/catch_console_colour.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/internal/catch_console_colour.cpp b/include/internal/catch_console_colour.cpp index 13290544..946e2903 100644 --- a/include/internal/catch_console_colour.cpp +++ b/include/internal/catch_console_colour.cpp @@ -20,6 +20,7 @@ #include "catch_stream.h" #include "catch_context.h" #include "catch_platform.h" +#include "catch_debugger.h" namespace Catch { namespace { @@ -156,6 +157,13 @@ namespace { } }; + bool useColourOnPlatform() { + return +#ifdef CATCH_PLATFORM_MAC + !isDebuggerActive() && +#endif + isatty(STDOUT_FILENO); + } IColourImpl* platformColourInstance() { ErrnoGuard guard; IConfigPtr config = getCurrentContext().getConfig(); @@ -163,7 +171,7 @@ namespace { ? config->useColour() : UseColour::Auto; if( colourMode == UseColour::Auto ) - colourMode = isatty(STDOUT_FILENO) + colourMode = useColourOnPlatform() ? UseColour::Yes : UseColour::No; return colourMode == UseColour::Yes