mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	Don't use console colour if running in XCode
This commit is contained in:
		@@ -20,6 +20,7 @@
 | 
				
			|||||||
#include "catch_stream.h"
 | 
					#include "catch_stream.h"
 | 
				
			||||||
#include "catch_context.h"
 | 
					#include "catch_context.h"
 | 
				
			||||||
#include "catch_platform.h"
 | 
					#include "catch_platform.h"
 | 
				
			||||||
 | 
					#include "catch_debugger.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Catch {
 | 
					namespace Catch {
 | 
				
			||||||
    namespace {
 | 
					    namespace {
 | 
				
			||||||
@@ -156,6 +157,13 @@ namespace {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool useColourOnPlatform() {
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					#ifdef CATCH_PLATFORM_MAC
 | 
				
			||||||
 | 
					            !isDebuggerActive() &&
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					            isatty(STDOUT_FILENO);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    IColourImpl* platformColourInstance() {
 | 
					    IColourImpl* platformColourInstance() {
 | 
				
			||||||
        ErrnoGuard guard;
 | 
					        ErrnoGuard guard;
 | 
				
			||||||
        IConfigPtr config = getCurrentContext().getConfig();
 | 
					        IConfigPtr config = getCurrentContext().getConfig();
 | 
				
			||||||
@@ -163,7 +171,7 @@ namespace {
 | 
				
			|||||||
            ? config->useColour()
 | 
					            ? config->useColour()
 | 
				
			||||||
            : UseColour::Auto;
 | 
					            : UseColour::Auto;
 | 
				
			||||||
        if( colourMode == UseColour::Auto )
 | 
					        if( colourMode == UseColour::Auto )
 | 
				
			||||||
            colourMode = isatty(STDOUT_FILENO)
 | 
					            colourMode = useColourOnPlatform()
 | 
				
			||||||
                ? UseColour::Yes
 | 
					                ? UseColour::Yes
 | 
				
			||||||
                : UseColour::No;
 | 
					                : UseColour::No;
 | 
				
			||||||
        return colourMode == UseColour::Yes
 | 
					        return colourMode == UseColour::Yes
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user