mirror of
https://github.com/YosysHQ/sby.git
synced 2025-04-12 16:28:17 +00:00
Fix readline() handling for partial lines
This commit is contained in:
parent
7be55edc7d
commit
221018b19d
|
@ -35,6 +35,7 @@ class SbyTask:
|
||||||
self.logfile = logfile
|
self.logfile = logfile
|
||||||
self.noprintregex = None
|
self.noprintregex = None
|
||||||
self.notify = []
|
self.notify = []
|
||||||
|
self.linebuffer = ""
|
||||||
|
|
||||||
for dep in self.deps:
|
for dep in self.deps:
|
||||||
dep.register_dep(self)
|
dep.register_dep(self)
|
||||||
|
@ -95,7 +96,11 @@ class SbyTask:
|
||||||
while True:
|
while True:
|
||||||
outs = self.p.stdout.readline().decode("utf-8")
|
outs = self.p.stdout.readline().decode("utf-8")
|
||||||
if len(outs) == 0: break
|
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 len(outs) == 0: continue
|
||||||
if self.noprintregex is None or not self.noprintregex.match(outs):
|
if self.noprintregex is None or not self.noprintregex.match(outs):
|
||||||
self.job.log("%s: %s" % (self.info, outs))
|
self.job.log("%s: %s" % (self.info, outs))
|
||||||
|
|
Loading…
Reference in a new issue