* Only colorise if we are attached to a terminal.

This commit is contained in:
Eelco Dolstra 2005-10-06 15:01:46 +00:00
parent b87b9c0d1f
commit cec2be64f3

View file

@ -13,6 +13,8 @@
#include <ctime>
#include <algorithm>
#include <unistd.h>
typedef enum {
srcNixExprDrvs,
@ -711,6 +713,7 @@ static VersionDiff compareVersionAgainstSet(
static string colorString(const string & s)
{
if (!isatty(STDOUT_FILENO)) return s;
return "\e[1;31m" + s + "\e[0m";
}