summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2022-06-09 09:38:04 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2022-08-08 10:22:50 +0200
commitdc25210d889ebbcdfe96bd814a355961e80bccb3 (patch)
tree29e1d7a0c6daefecff024330e8e970265be34d9f
parent7d10b39f7ad95f6ca3731fb58b1644018e8dea6b (diff)
Keep color disabled if APT::Color was set to false
Support for envvar NO_COLOR was added in 2.3.11, but with our own options we can also be a tiny bit more sensible in not overriding an explicit choice to disable colors. References: 400a6895566b67d70bcde43dc8a1cc1c7121f87d
-rw-r--r--apt-private/private-output.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc
index 04cb148ba..03fbe47e1 100644
--- a/apt-private/private-output.cc
+++ b/apt-private/private-output.cc
@@ -86,9 +86,9 @@ bool InitOutput(std::basic_streambuf<char> * const out) /*{{{*/
SigWinch(0);
}
- if(!isatty(1) || getenv("NO_COLOR") != nullptr)
+ if (isatty(STDOUT_FILENO) == 0 || not _config->FindB("APT::Color", true) || getenv("NO_COLOR") != nullptr)
{
- _config->Set("APT::Color", "false");
+ _config->Set("APT::Color", false);
_config->Set("APT::Color::Highlight", "");
_config->Set("APT::Color::Neutral", "");
} else {