Don't use console colour if running in XCode

This commit is contained in:
Phil Nash 2017-09-19 15:25:33 +01:00
parent 0a146e3af7
commit 54f1ce2af2
1 changed files with 9 additions and 1 deletions

View File

@ -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