Makefile: Fix regression that prints unnecessary VT100 escape sequences

Since commit 509c424472 (StdIo: Replace uses of KWSys Terminal with
StdIo::Print, 2025-05-08, v4.1.0-rc1~151^2~2) we print unnecessary VT100
escape sequences to establish normal text even when not intending to
print color.  In combination with `CLICOLOR_FORCE=1`, this breaks
detection of implicit link information from compiler driver output.

Fixes: #27137
This commit is contained in:
Brad King
2025-08-13 15:24:50 -04:00
parent a0a9e48f85
commit 914803bf31

View File

@@ -1874,7 +1874,7 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string> const& args)
bool enabled = true;
static cm::StdIo::TermAttrSet const noAttrs;
cm::StdIo::TermAttrSet attrs = cm::StdIo::TermAttr::Normal;
cm::StdIo::TermAttrSet attrs;
bool newline = true;
std::string progressDir;
for (auto const& arg : cmMakeRange(args).advance(2)) {
@@ -1910,6 +1910,9 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string> const& args)
} else if (arg == "--white") {
attrs = cm::StdIo::TermAttr::ForegroundWhite;
} else if (arg == "--bold") {
if (attrs.empty()) {
attrs = cm::StdIo::TermAttr::Normal;
}
attrs |= cm::StdIo::TermAttr::ForegroundBold;
} else if (arg == "--no-newline") {
newline = false;