Skip to content

Commit e095401

Browse files
committed
Time out in _get_executable_info
Time out after 30 seconds. This is used for version queries which should be very fast, so a 30-second delay would be unusual. GitHub Actions test runs have been hanging trying to get the inkscape version when using Python 3.14: https://github.com/matplotlib/matplotlib/actions/runs/16043158943/job/45268507848#step:13:836
1 parent 70d5ad4 commit e095401

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,15 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
400400
try:
401401
output = subprocess.check_output(
402402
args, stderr=subprocess.STDOUT,
403-
text=True, errors="replace")
403+
text=True, errors="replace", timeout=30)
404404
except subprocess.CalledProcessError as _cpe:
405405
if ignore_exit_code:
406406
output = _cpe.output
407407
else:
408408
raise ExecutableNotFoundError(str(_cpe)) from _cpe
409+
except subprocess.TimeoutExpired as _te:
410+
msg = f"Timed out running {' '.join(args)}"
411+
raise ExecutableNotFoundError(msg) from _te
409412
except OSError as _ose:
410413
raise ExecutableNotFoundError(str(_ose)) from _ose
411414
match = re.search(regex, output)

0 commit comments

Comments
 (0)