Verified Commit 4ab73125 authored by Karel Koci's avatar Karel Koci 🤘
Browse files

nsfarm/cli: fix delayed logging of PexpectLogging

The issue was invalid condition as well as that if all input was
consumed that linebuf stayed set to old (already consumed) value.
parent cebecdc2
......@@ -327,9 +327,8 @@ class PexpectLogging:
"""
jbuf = self.linebuf + buf
lines = jbuf.splitlines(keepends=True)
if lines[-1] or lines[-1][-1] not in self._EXPECTED_EOL:
# The last line is not terminated (no new line character) so just preserve it
self.linebuf = lines.pop()
# If the last line is not terminated (no new line character) so just preserve it
self.linebuf = lines.pop() if lines[-1] and lines[-1][-1] not in self._EXPECTED_EOL else b''
for line in lines:
self._log(line)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment