Skip to content

widget.py: Avoid extra empty lines when message-lines or error-lines is 0 - #2208

Merged
juergbi merged 2 commits into
apache:masterfrom
Thanatos9404:thanatos/message-lines-zero
Oct 20, 2026
Merged

juergbi merged 2 commits into
apache:masterfrom
Thanatos9404:thanatos/message-lines-zero

Conversation

@Thanatos9404

Copy link
Copy Markdown
Contributor

With message-lines set to 0, the detail of a message is truncated to nothing, but LogLine still prints an empty line, a line holding only the indentation and another empty line after the message. A failure message in verbose mode with error-lines set to 0 is followed by two empty lines instead of one.

The detail is now only printed when some of it is left, and the newline before the failure details is only added when they are shown. Failure messages keep their single trailing empty line, so entries in the failure summary stay separated. Output is unchanged when both options are non-zero.

I added tests in tests/frontend/logging.py that render messages through LogLine, and ran tests/frontend, black, pylint and mypy locally.

Fixes #2145

…is 0

With message-lines set to 0, the detail of a message is truncated
away entirely, but LogLine still prints an empty line, a line with
only the indentation and another empty line after the message.

Likewise, a failure message in verbose mode with error-lines set to 0
skips the log tail, but is still followed by two empty lines instead
of the usual one.

Only print the message detail when some of it is left, and only add
the newline that introduces the failure details when they are printed.
Failure messages keep the single empty line that separates them from
the next message, and from the next entry in the failure summary.

Fixes apache#2145
Render messages with LogLine and check that no empty lines are left
behind when message-lines is 0, that a truncated message still reports
how many lines were left out, and that a failure message is followed
by a single empty line when error-lines is 0.

This is a part of apache#2145
Comment thread src/buildstream/_frontend/widget.py Resolved
@juergbi
juergbi merged commit 31b0272 into apache:master Oct 20, 2026
37 of 52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants