From 221018b19dd55c9700fa75661e6f7ff3f275acd8 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 13 Feb 2017 16:59:34 +0100 Subject: [PATCH] Fix readline() handling for partial lines --- sbysrc/sby_core.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sbysrc/sby_core.py b/sbysrc/sby_core.py index d53d7d6..a1aaec3 100644 --- a/sbysrc/sby_core.py +++ b/sbysrc/sby_core.py @@ -35,6 +35,7 @@ class SbyTask: self.logfile = logfile self.noprintregex = None self.notify = [] + self.linebuffer = "" for dep in self.deps: dep.register_dep(self) @@ -95,7 +96,11 @@ class SbyTask: while True: outs = self.p.stdout.readline().decode("utf-8") if len(outs) == 0: break - outs = outs.strip() + if outs[-1] != '\n': + self.linebuffer += outs + break + outs = (self.linebuffer + outs).strip() + self.linebuffer = "" if len(outs) == 0: continue if self.noprintregex is None or not self.noprintregex.match(outs): self.job.log("%s: %s" % (self.info, outs)) -- 2.30.2