From 0b8b04932d58cc9b70a0b0b6a6ea188e9e7c194f Mon Sep 17 00:00:00 2001 From: Agah Date: Sat, 7 Dec 2024 19:18:58 -0500 Subject: [PATCH] argh --- myst_libre/tools/myst_client.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/myst_libre/tools/myst_client.py b/myst_libre/tools/myst_client.py index af1c819..61b24a5 100644 --- a/myst_libre/tools/myst_client.py +++ b/myst_libre/tools/myst_client.py @@ -115,9 +115,25 @@ def run_command(self, *args, env_vars={}, user=None, group=None): else: process = subprocess.Popen(command, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, cwd=self.build_dir) - # Stream stdout and stderr in real-time - stdout_log, stderr_log = process.communicate() - + stdout_log = "" + stderr_log = "" + # Stream stdout in real-time + while True: + output = process.stdout.readline() + if output == b"" and process.poll() is not None: + break + if output: + stdout_log += output.decode() + self.cprint(output.decode(), "light_grey") # Print stdout in real-time + + while True: + error = process.stderr.readline() + if error == b"" and process.poll() is not None: + break + if error: + stderr_log += error.decode() + self.cprint(error.decode(), "red") # Print stderr in real-time + process.wait() if process.returncode != 0: