Don't try to colorize errors when running in Xcode

This commit is contained in:
ridiculousfish 2014-08-04 13:55:53 -07:00
parent 33c714ca03
commit cb480dddf6

View file

@ -144,15 +144,24 @@ static void err(const wchar_t *blah, ...)
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
if (colorize)
{
fputs("\x1b[31m", stdout);
}
wprintf(L"Error: ");
vwprintf(blah, va);
va_end(va);
// return to normal color
if (colorize)
{
fputs("\x1b[0m", stdout);
}
wprintf(L"\n");
}