Skip to content

Fix doubled newlines and blank separators in build logs - #725

Open
bschwedler wants to merge 3 commits into
mainfrom
fix/build-log-formatting
Open

Fix doubled newlines and blank separators in build logs#725
bschwedler wants to merge 3 commits into
mainfrom
fix/build-log-formatting

Conversation

@bschwedler

Copy link
Copy Markdown
Contributor

PrefixedLogSink.write() doubled every line's newline and printed buildx's blank separator lines as bare [key] tags.

Strips the line's own trailing terminator before printing and drops blank lines outright.

Closes #724

PrefixedLogSink.write() printed streamed build-output lines verbatim
through Rich's Console.print(), which appends its own trailing
newline. Lines from python_on_whales's stream_logs come from
pipe.readline(), which keeps the original line terminator, so every
line of `bakery build --strategy build` output was followed by a
blank line.

Strip the trailing \r\n before assembling the prefixed line so
Console.print supplies exactly one newline per line.
buildx's plain progress output uses bare blank lines to separate
build steps. After stripping trailing newlines, those became lines
containing only the `[key]` prefix and no content -- clutter rather
than useful separation once every other line is already tagged with
its key.

Skip printing when a line is empty (or whitespace-only) after the
newline strip, instead of printing a bare `[key]`.
The prior wording framed the drop as targeting "buildx's own step
separators," implying the code can tell a buildx separator apart from
any other blank line. It can't -- write() drops every blank line
unconditionally, regardless of source (e.g. a RUN command's own blank
stdout output would be dropped the same way). Reworded to say what
the code actually does.
@bschwedler
bschwedler requested a review from ianpittwood as a code owner August 7, 2026 20:21
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Test Results

2 084 tests  +6   2 084 ✅ +6   9m 5s ⏱️ +57s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit b7bfc43. ± Comparison against base commit 6d43028.

@ianpittwood ianpittwood left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually tested, great fix!

@bschwedler
bschwedler added this pull request to the merge queue Aug 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parallel build logs have doubled newlines and blank separator lines

2 participants