From 914803bf3123770cc36c51950c725dadf4608b14 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 13 Aug 2025 15:24:50 -0400 Subject: [PATCH] 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 --- Source/cmcmd.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 69f64af479..66efbd3b75 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -1874,7 +1874,7 @@ int cmcmd::ExecuteEchoColor(std::vector 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 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;