Skip to content

Commit a326d07

Browse files
sanrishitimhoffm
andauthored
BUG: Fix Windows subprocess timeouts with CREATE_NO_WINDOW flag (#30886)
* Added CREATE_NO_WINDOW flag on Windows to prevent console window overhead * Fixed Ruff Failed check error * Fixed Ruff error * Update lib/matplotlib/testing/__init__.py Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --------- Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
1 parent 424e74c commit a326d07

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/matplotlib/testing/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ def subprocess_run_for_testing(command, env=None, timeout=60, stdout=None,
9292
"""
9393
if capture_output:
9494
stdout = stderr = subprocess.PIPE
95+
# Add CREATE_NO_WINDOW flag on Windows to prevent console window overhead
96+
# This is added in an attempt to fix flaky timeouts of subprocesses on Windows
97+
if sys.platform == 'win32':
98+
if 'creationflags' not in kwargs:
99+
kwargs['creationflags'] = subprocess.CREATE_NO_WINDOW
100+
else:
101+
kwargs['creationflags'] |= subprocess.CREATE_NO_WINDOW
95102
try:
96103
proc = subprocess.run(
97104
command, env=env,

0 commit comments

Comments
 (0)