Skip to content

Commit 0b8b049

Browse files
committed
argh
1 parent 41e7032 commit 0b8b049

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

myst_libre/tools/myst_client.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,25 @@ def run_command(self, *args, env_vars={}, user=None, group=None):
115115
else:
116116
process = subprocess.Popen(command, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, cwd=self.build_dir)
117117

118-
# Stream stdout and stderr in real-time
119-
stdout_log, stderr_log = process.communicate()
120-
118+
stdout_log = ""
119+
stderr_log = ""
120+
# Stream stdout in real-time
121+
while True:
122+
output = process.stdout.readline()
123+
if output == b"" and process.poll() is not None:
124+
break
125+
if output:
126+
stdout_log += output.decode()
127+
self.cprint(output.decode(), "light_grey") # Print stdout in real-time
128+
129+
while True:
130+
error = process.stderr.readline()
131+
if error == b"" and process.poll() is not None:
132+
break
133+
if error:
134+
stderr_log += error.decode()
135+
self.cprint(error.decode(), "red") # Print stderr in real-time
136+
121137
process.wait()
122138

123139
if process.returncode != 0:

0 commit comments

Comments
 (0)