Skip to content

Commit

Permalink
argh
Browse files Browse the repository at this point in the history
  • Loading branch information
agahkarakuzu committed Dec 8, 2024
1 parent 41e7032 commit 0b8b049
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions myst_libre/tools/myst_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0b8b049

Please sign in to comment.