Skip to content

Fix command output truncated at first empty line - #4259

Open
christian-klemmer wants to merge 1 commit into
deployphp:masterfrom
christian-klemmer:fix/logger-output-truncated-on-empty-line
Open

christian-klemmer wants to merge 1 commit into
deployphp:masterfrom
christian-klemmer:fix/logger-output-truncated-on-empty-line

Conversation

@christian-klemmer

Copy link
Copy Markdown

Fixes the regression described in #4256.

Logger::print() returned from the whole method when it hit an empty line, so everything after it was missing from the console output and from the file log. Because the check used empty(), a line
containing only "0" also cut the output off.

This shows up with any command whose output contains blank lines, for example test results or coverage reports in CI.

Changes

  • Replace empty($line) with a strict $line === '' check, so "0" lines are kept.
  • Use continue instead of return, so only the empty line is skipped and the rest of the buffer is still printed and logged.
  • Add two unit tests in LoggerTest covering console output and file logging with blank lines and "0" lines.

Empty lines are still dropped, as before. Only the truncation is fixed.

Logger::print() returned from the whole method when it hit an empty
line, so everything after it was dropped from the console output and
the file log. Because the check used empty(), a line containing only
"0" also cut the output off.

Skip empty lines with a strict `$line === ''` check and `continue`
instead of `return`.

Refs: deployphp#4256

This branch has not been deployed

No deployments
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.

1 participant