mirror of
https://github.com/YosysHQ/sby.git
synced 2025-04-07 06:44:06 +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.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))
|
||||
|
|
Loading…
Reference in a new issue