From 20ace5503422a8511036aa9d486435041127e0cf Mon Sep 17 00:00:00 2001 From: alvinhochun Date: Wed, 19 Oct 2022 00:07:18 +0800 Subject: [PATCH] Allow ANSI colour to be compiled on Windows This enables building with `CATCH_CONFIG_COLOUR_ANSI` on Windows. The changes are taken from v3 commit 0e176c318bf309aaa4acd8686a82517fda7b859a. --- include/internal/catch_console_colour.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/internal/catch_console_colour.cpp b/include/internal/catch_console_colour.cpp index de0fff43..0d2fde0e 100644 --- a/include/internal/catch_console_colour.cpp +++ b/include/internal/catch_console_colour.cpp @@ -121,7 +121,10 @@ namespace { #elif defined( CATCH_CONFIG_COLOUR_ANSI ) ////////////////////////////////////// -#include +#if defined( CATCH_PLATFORM_LINUX ) || defined( CATCH_PLATFORM_MAC ) +# define CATCH_INTERNAL_HAS_ISATTY +# include +#endif namespace Catch { namespace { @@ -170,7 +173,8 @@ namespace { #if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) !isDebuggerActive() && #endif -#if !(defined(__DJGPP__) && defined(__STRICT_ANSI__)) +#if defined( CATCH_INTERNAL_HAS_ISATTY ) && \ + !( defined( __DJGPP__ ) && defined( __STRICT_ANSI__ ) ) isatty(STDOUT_FILENO) #else false