From eb4b0bd26f7c2d449b95b529664dd506b61b90b6 Mon Sep 17 00:00:00 2001 From: hoelee Date: Mon, 12 Oct 2026 18:51:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE:=20run=5Fpinned=20=E6=8A=8A=20capture?= =?UTF-8?q?=5Foutput=20=E4=BC=A0=E7=BB=99=20Popen=20=E5=AF=BC=E8=87=B4=20T?= =?UTF-8?q?ypeError?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit subprocess.run 的 capture_output 是它的语法糖,Popen 不认这个参数 → run()/_sh 这三个 ffmpeg 调用点全炸,三个 lane 在 2.5 分钟内秒失败 64 项(每项 attempts 用光变 failed)。 补上展开: capture_output=True → stdout/stderr=PIPE。本地与生产均已复验 rc=0。 --- scripts/library_run.py | 7 +++++++ 1 file changed, 7 insertions(+) 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: