From cec2be64f36dce184986cbe69adf80a3fac6985a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 6 Oct 2005 15:01:46 +0000 Subject: [PATCH] * Only colorise if we are attached to a terminal. --- src/nix-env/main.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc index 6d542c9b6..f0493bb5e 100644 --- a/src/nix-env/main.cc +++ b/src/nix-env/main.cc @@ -13,6 +13,8 @@ #include #include +#include + 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"; }