diff --git a/scripts/library_run.py b/scripts/library_run.py index 79618f8..82c83f9 100644 --- a/scripts/library_run.py +++ b/scripts/library_run.py @@ -82,6 +82,13 @@ def pin_child(pid): def run_pinned(cmd, timeout=None, **kw): """subprocess.run() with the child pinned to CHILD_MASK (see pin_child).""" kw.setdefault("creationflags", NOWIN) + # `capture_output` is a subprocess.run() convenience Popen does not accept - expand it here, + # otherwise every caller that passes it dies with + # "Popen.__init__() got an unexpected keyword argument 'capture_output'" (measured: all three + # lanes failed every item within a second of this wrapper being introduced). + if kw.pop("capture_output", False): + kw.setdefault("stdout", subprocess.PIPE) + kw.setdefault("stderr", subprocess.PIPE) p = subprocess.Popen(cmd, **kw) pin_child(p.pid) try: