From 486872150638d56483c2bc429ba9e137d9974ee8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 15 Mar 2018 16:08:07 +0100 Subject: Filter ANSI colors when not writing to a terminal Fixes https://github.com/NixOS/nixpkgs/issues/37114. --- src/libutil/util.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libutil/util.cc') diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 2391e14a94bd..a60ba8508e31 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -1185,7 +1185,7 @@ void ignoreException() } -std::string filterANSIEscapes(const std::string & s, unsigned int width) +std::string filterANSIEscapes(const std::string & s, bool filterAll, unsigned int width) { std::string t, e; size_t w = 0; @@ -1210,7 +1210,7 @@ std::string filterANSIEscapes(const std::string & s, unsigned int width) if (i != s.end() && *i >= 0x40 && *i <= 0x5f) e += *i++; } - if (last == 'm') + if (!filterAll && last == 'm') t += e; } -- cgit 1.4.1