aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
authorYestin L. Harrison <yestin@ylh.io>2021-07-01 18:19:01 -0600
committerYestin L. Harrison <yestin@ylh.io>2021-07-01 18:19:01 -0600
commit20cce079f258dc3f62340ecd7b9de1bbd99ef814 (patch)
tree348b44b7537de6235e6a78914155c18f239166f6 /src/libutil/util.cc
parent139f7af5ec40ca75ad2ef9393c5029f0850105d9 (diff)
Respect TERM=dumb more consistently
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 7e57fd7ca..94460b367 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -1372,6 +1372,10 @@ void ignoreException()
}
}
+bool shouldANSI()
+{
+ return isatty(STDERR_FILENO) && getEnv("TERM").value_or("dumb") != "dumb";
+}
std::string filterANSIEscapes(const std::string & s, bool filterAll, unsigned int width)
{