File tree Expand file tree Collapse file tree 1 file changed +18
-15
lines changed
Expand file tree Collapse file tree 1 file changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -42,21 +42,24 @@ def run_command(command, label):
4242 bufsize = 1
4343 )
4444
45- # log stdout
46- for line in iter (process .stdout .readline , '' ):
47- if line .strip ():
48- logging .info (f"{ label } : { line .rstrip ()} " )
49-
50- # log stderr
51- for line in iter (process .stderr .readline , '' ):
52- if line .strip ():
53- logging .error (f"{ label } : { line .rstrip ()} " )
54-
55- # Wait for process to complete and check return code
56- return_code = process .wait ()
57- if return_code != 0 :
58- raise subprocess .CalledProcessError (return_code , command )
59-
45+ # Read both stdout and stderr concurrently
46+ stdout , stderr = process .communicate ()
47+
48+ # Log stdout
49+ if stdout :
50+ for line in stdout .splitlines ():
51+ if line .strip ():
52+ logging .info (f"{ label } : { line } " )
53+
54+ # Log stderr
55+ if stderr :
56+ for line in stderr .splitlines ():
57+ if line .strip ():
58+ logging .error (f"{ label } : { line } " )
59+
60+ # Check return code
61+ if process .returncode != 0 :
62+ raise subprocess .CalledProcessError (process .returncode , command )
6063def run_prebuild_script ():
6164 """ Run the defang-docs repo prebuild script"""
6265
You can’t perform that action at this time.
0 commit comments