aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYestin L. Harrison <yestin@ylh.io>2021-07-02 09:33:54 -0600
committerYestin L. Harrison <yestin@ylh.io>2021-07-02 09:33:54 -0600
commit0fe84bef7286bf9b38dbb628f450ac07079f8fed (patch)
tree77590a4fab0447e2fbabb405e83577ef96e735a3 /src
parent20cce079f258dc3f62340ecd7b9de1bbd99ef814 (diff)
Add $NO_COLOR check to ANSI escape conditions
Diffstat (limited to 'src')
-rw-r--r--src/libutil/util.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 94460b367..ee9f17228 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -1374,7 +1374,9 @@ void ignoreException()
bool shouldANSI()
{
- return isatty(STDERR_FILENO) && getEnv("TERM").value_or("dumb") != "dumb";
+ return isatty(STDERR_FILENO)
+ && getEnv("TERM").value_or("dumb") != "dumb"
+ && !getEnv("NO_COLOR").has_value();
}
std::string filterANSIEscapes(const std::string & s, bool filterAll, unsigned int width)