Command output is truncated at the first empty line of each chunk #4256
Unanswered
christian-klemmer
asked this question in
Bugs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Deployer Version
v8.0.0
Target OS
Ubuntu 24.04
Which PHP version are you using?
PHP 8.3
Content of deploy.php or deploy.yaml
Steps to reproduce
Expected behavior
(Empty lines may be omitted, as in Deployer 7)
Actual behavior
Cause
In
src/Logger/Logger.php,print()usesreturnwhen it encounters an empty line inside the loop:This aborts processing of the remaining lines of the buffer. When it happens in the first loop, the file log is skipped entirely for that chunk.
In Deployer 7 this logic lived in a per-line
writeln()method, wherereturnonly skipped the single empty line. The v8 refactoring moved it into a loop, which changed the behavior.Additionally,
empty()is also true for a line containing just"0", which would truncate the output as well.Suggested fix
if ($this->output->isVerbose() || $force) { foreach (explode("\n", rtrim($buffer)) as $line) { - if (empty($line)) { - return; + if ($line === '') { + continue; } $this->output->writeln("[{$host->getTag()}] $line"); } } foreach (explode("\n", rtrim($buffer)) as $line) { - if (empty($line)) { - return; + if ($line === '') { + continue; } $this->fileLog->writeln("[{$host->getAlias()}] $line"); }I first noticed this change in behaviour when my GitLab pipeline stopped reporting test-results/code-coverage summation.
Deployer 8 output
Deployer 7 output
All reactions