mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Don't try to colorize errors when running in Xcode
This commit is contained in:
parent
33c714ca03
commit
cb480dddf6
1 changed files with 11 additions and 2 deletions
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue