1
0
Fork 0

(svn r17227) -Feature [Unix]: Only use colorized error output on terminals.

release/1.0
matthijs 2009-08-20 10:01:42 +00:00
parent 91aaf8350b
commit 0188ebad56
1 changed files with 4 additions and 1 deletions

View File

@ -222,7 +222,10 @@ void ShowOSErrorBox(const char *buf, bool system)
ShowMacDialog( buf, "See readme for more info\nMost likely you are missing files from the original TTD", "Quit" );
#else
/* all systems, but OSX */
fprintf(stderr, "\033[1;31mError: %s\033[0;39m\n", buf);
if (isatty(fileno(stderr))) /* Only use escape codes on a TTY */
fprintf(stderr, "\033[1;31mError: %s\033[0;39m\n", buf);
else
fprintf(stderr, "Error: %s\n", buf);
#endif
}