diff --git a/python/sglang/test/ci/ci_utils.py b/python/sglang/test/ci/ci_utils.py index 8863e4b3d..9e0ed0b2b 100644 --- a/python/sglang/test/ci/ci_utils.py +++ b/python/sglang/test/ci/ci_utils.py @@ -223,10 +223,18 @@ def run_unittest_files( errors="ignore", # Ignore non-UTF-8 bytes to prevent UnicodeDecodeError ) output_lines = [] - for line in process.stdout: - logger.info(line.rstrip()) - output_lines.append(line) + + def read_output(): + for line in process.stdout: + logger.info(line.rstrip()) + output_lines.append(line) + + # Read stdout on a background thread so the main thread won't block on EOF. + reader_thread = threading.Thread(target=read_output, daemon=True) + reader_thread.start() process.wait() + # Bounded wait for the reader to finish. + reader_thread.join(timeout=60) else: process = subprocess.Popen(cmd, stdout=None, stderr=None) process.wait()