From cb480dddf67b5f53996dfd448182c6e5315ef026 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 4 Aug 2014 13:55:53 -0700 Subject: [PATCH] Don't try to colorize errors when running in Xcode --- fish_tests.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fish_tests.cpp b/fish_tests.cpp index 960931542..7cc5fb9a6 100644 --- a/fish_tests.cpp +++ b/fish_tests.cpp @@ -143,16 +143,25 @@ static void err(const wchar_t *blah, ...) va_list va; va_start(va, blah); err_count++; + + // Xcode's term doesn't support color (even though TERM claims it does) + bool colorize = ! getenv("RUNNING_IN_XCODE"); // show errors in red - fputs("\x1b[31m", stdout); + if (colorize) + { + fputs("\x1b[31m", stdout); + } wprintf(L"Error: "); vwprintf(blah, va); va_end(va); // return to normal color - fputs("\x1b[0m", stdout); + if (colorize) + { + fputs("\x1b[0m", stdout); + } wprintf(L"\n"); }