about summary refs log tree commit diff
path: root/src/nix-env
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-10-06T15·01+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-10-06T15·01+0000
commitcec2be64f36dce184986cbe69adf80a3fac6985a (patch)
treea37af63e79ddd60797ecdefe282a818361babea7 /src/nix-env
parentb87b9c0d1fcbce045f05379d0efe9ae14d0f87e6 (diff)
* Only colorise if we are attached to a terminal.
Diffstat (limited to 'src/nix-env')
-rw-r--r--src/nix-env/main.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc
index 6d542c9b6d43..f0493bb5e2af 100644
--- a/src/nix-env/main.cc
+++ b/src/nix-env/main.cc
@@ -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";
 }