Don't append the build prefix when a line is being continued from a previous log entry (#40947)
Blue committed
Jun 30, 2026 at 15:51 UTC
5321612cd553ad599c19a49783996b0d5498173e
1 file changed
+9
-3
src/windows/wslcsession/WSLCSession.cpp
+9
-3
@@ -63,14 +63,14 @@ void EnforceRegistryAllowlist(const std::string& Repo)
63
THROW_HR_WITH_USER_ERROR(WSLC_E_REGISTRY_BLOCKED_BY_POLICY, Localization::MessageRegistryBlockedByPolicy(serverWide));
64
}
65
66
-std::string IndentLines(const std::string& input, const std::string& prefix)
66
+std::string IndentLines(const std::string& input, const std::string& prefix, bool prefixFirstLine = true)
67
{
68
if (input.empty())
69
{
70
return {};
71
}
72
73
- std::string result = prefix;
73
+ std::string result = prefixFirstLine ? prefix : "";
74
for (size_t i = 0; i < input.size(); i++)
75
{
76
result.push_back(input[i]);
@@ -1085,6 +1085,10 @@ try
1085
std::string decoded = wslutil::Base64Decode(log.data);
1086
if (!decoded.empty())
1087
{
1088
+ // The first character of this chunk begins a new line (and so needs a stage prefix) unless it
1089
+ // continues an unterminated line from the same vertex.
1090
+ bool continuingLine = needsNewline && log.vertex == lastLogVertex;
1091
+
1092
if (log.vertex != lastLogVertex && decoded[0] != '\n')
1093
{
1094
flushLine();
@@ -1096,11 +1100,13 @@ try
1100
{
1101
reportProgress(decoded.substr(0, 1), c_logId);
1102
decoded.erase(0, 1);
1103
+
1104
+ continuingLine = false;
1105
}
1106
1107
if (!decoded.empty())
1108
{
1103
- reportProgress(IndentLines(decoded, logPrefix(it->second)), c_logId);
1109
+ reportProgress(IndentLines(decoded, logPrefix(it->second), !continuingLine), c_logId);
1110
}
1111
1112
needsNewline = !decoded.empty() && decoded.back() != '\n';