[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1010806: apt: Avoid color output on monochrome terminals



Package: apt
Version: 2.2.4
Severity: normal

Dear Maintainer,

The apt command shows colors on monochrome terminals (even on a dumb terminal),
please avoid this. Included is a patch which i believe will solve the problem
and only allows output on terminals which actually have 'color' in them; the
same logic as to when to color the default bash prompt.
I have not tested this patch.

Kind regards,
Axel


--- private-output.cc.orig	2022-05-10 14:18:27.611767218 +0200
+++ private-output.cc	2022-05-10 14:20:17.511703336 +0200
@@ -86,7 +86,8 @@
       SigWinch(0);
    }
 
-   if(!isatty(1))
+   char *term = getenv("TERM");
+   if(!isatty(1) || strstr(term, "color") == NULL)
    {
       _config->Set("APT::Color", "false");
       _config->Set("APT::Color::Highlight", "");


Reply to: