Skip to content

Commit 20ace55

Browse files
alvinhochunhorenmar
authored andcommitted
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 0e176c3.
1 parent 182c910 commit 20ace55

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

include/internal/catch_console_colour.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ namespace {
121121

122122
#elif defined( CATCH_CONFIG_COLOUR_ANSI ) //////////////////////////////////////
123123

124-
#include <unistd.h>
124+
#if defined( CATCH_PLATFORM_LINUX ) || defined( CATCH_PLATFORM_MAC )
125+
# define CATCH_INTERNAL_HAS_ISATTY
126+
# include <unistd.h>
127+
#endif
125128

126129
namespace Catch {
127130
namespace {
@@ -170,7 +173,8 @@ namespace {
170173
#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE)
171174
!isDebuggerActive() &&
172175
#endif
173-
#if !(defined(__DJGPP__) && defined(__STRICT_ANSI__))
176+
#if defined( CATCH_INTERNAL_HAS_ISATTY ) && \
177+
!( defined( __DJGPP__ ) && defined( __STRICT_ANSI__ ) )
174178
isatty(STDOUT_FILENO)
175179
#else
176180
false

0 commit comments

Comments
 (0)