← Commit history

v0.9.2 defensive subprocess

John Lauer ·8897c422f2 ·3mo ago ·parent 2a31f37
1 file changed +5−4
kicad_detect.py+5−4
@@ -12,6 +12,7 @@ explicitly request an older version via the `kicadVersion` arg on commands. import os import re import subprocess+from proc import run as _safe_run import sys from pathlib import Path @@ -275,7 +276,7 @@ def _probe_python_version(python_exe: Path) -> str | None:     if not python_exe.exists():         return None     try:-        result = subprocess.run(+        result = _safe_run(             [str(python_exe), "--version"],             capture_output=True, text=True, timeout=5,         )@@ -491,7 +492,7 @@ def _probe_ipc_api(python_exe: Path) -> dict:         "    json.dump({'available': False, 'scope': []}, sys.stdout)\n"     )     try:-        result = subprocess.run(+        result = _safe_run(             [str(python_exe), "-c", probe],             capture_output=True, text=True, timeout=5,         )@@ -574,7 +575,7 @@ def _win_detect_all() -> list[dict]:             if not cli.exists():                 return             try:-                result = subprocess.run([str(cli), "--version"], capture_output=True, text=True, timeout=5)+                result = _safe_run([str(cli), "--version"], capture_output=True, text=True, timeout=5)                 m = re.search(r"(\d+\.\d+(?:\.\d+)?)", result.stdout + result.stderr)                 if not m:                     return@@ -629,7 +630,7 @@ def _mac_app_version(app_path: Path) -> str | None:     if not plist.exists():         return None     try:-        result = subprocess.run(+        result = _safe_run(             ["/usr/libexec/PlistBuddy", "-c", "Print :CFBundleShortVersionString", str(plist)],             capture_output=True, text=True, timeout=5,         )