summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2009-08-20 10:01:42 +0000
committermatthijs <matthijs@openttd.org>2009-08-20 10:01:42 +0000
commit0188ebad5649d4c698245a2fef9039e6155b5f22 (patch)
tree0a0ef70dc711b2a1a3de9c4f1137093fb7addb65
parent91aaf8350bad8d5572babdedda2ba7c7e42ca7d3 (diff)
downloadopenttd-0188ebad5649d4c698245a2fef9039e6155b5f22.tar.xz
(svn r17227) -Feature [Unix]: Only use colorized error output on terminals.
-rw-r--r--src/unix.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/unix.cpp b/src/unix.cpp
index a58389387..ec4bb05ff 100644
--- a/src/unix.cpp
+++ b/src/unix.cpp
@@ -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
}