From d6186eff88519e8ad9508339528d770778883182 Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Thu, 4 Aug 2022 13:40:09 -0700 Subject: [PATCH] fpga/build_images.py: process both stdout and stderr Signed-off-by: Alex Forencich --- fpga/build_images.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/fpga/build_images.py b/fpga/build_images.py index 3be5a1298..6a71e3fa9 100755 --- a/fpga/build_images.py +++ b/fpga/build_images.py @@ -144,13 +144,10 @@ class Build: stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) - while True: - line = await proc.stdout.readline() - if not line: - break - line = line.decode('utf-8').strip() - - self.scan_log_line(line) + await asyncio.gather( + self.process_stream(proc.stdout), + self.process_stream(proc.stderr), + ) self.synth_done() self.build_done() @@ -166,6 +163,15 @@ class Build: self.elapsed_time = datetime.datetime.now() - self.start_time + async def process_stream(self, stream): + while True: + line = await stream.readline() + if not line: + break + line = line.decode('utf-8').strip() + + self.scan_log_line(line) + def scan_log_line(self, line): pass