修: run_pinned 把 capture_output 传给 Popen 导致 TypeError

subprocess.run 的 capture_output 是它的语法糖,Popen 不认这个参数 → run()/_sh 这三个
ffmpeg 调用点全炸,三个 lane 在 2.5 分钟内秒失败 64 项(每项 attempts 用光变 failed)。
补上展开: capture_output=True → stdout/stderr=PIPE。本地与生产均已复验 rc=0。
This commit is contained in:
2026-10-12 18:51:02 +08:00
parent 61d41707e9
commit eb4b0bd26f
+7
View File
@@ -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: