about summary refs log tree commit diff
path: root/src/nix-env/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-env/main.cc')
-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";
 }