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 0e176c318b.
This commit is contained in:
alvinhochun 2022-10-19 00:07:18 +08:00 committed by Martin Hořeňovský
parent 182c910b4b
commit 20ace55034

View File

@ -121,7 +121,10 @@ namespace {
#elif defined( CATCH_CONFIG_COLOUR_ANSI ) ////////////////////////////////////// #elif defined( CATCH_CONFIG_COLOUR_ANSI ) //////////////////////////////////////
#if defined( CATCH_PLATFORM_LINUX ) || defined( CATCH_PLATFORM_MAC )
# define CATCH_INTERNAL_HAS_ISATTY
# include <unistd.h> # include <unistd.h>
#endif
namespace Catch { namespace Catch {
namespace { namespace {
@ -170,7 +173,8 @@ namespace {
#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) #if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE)
!isDebuggerActive() && !isDebuggerActive() &&
#endif #endif
#if !(defined(__DJGPP__) && defined(__STRICT_ANSI__)) #if defined( CATCH_INTERNAL_HAS_ISATTY ) && \
!( defined( __DJGPP__ ) && defined( __STRICT_ANSI__ ) )
isatty(STDOUT_FILENO) isatty(STDOUT_FILENO)
#else #else
false false