🐛 fix(av1-transfer): use bash exec -a instead of executable= to rename ffmpeg process
subprocess.Popen with executable= fails on linuxbrew due to symlink/execve incompatibility. Use bash exec -a so ffmpeg is resolved via PATH instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@ import argparse
|
||||
import ctypes
|
||||
import ctypes.util
|
||||
import queue
|
||||
import shutil
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
@@ -130,22 +130,19 @@ def transcode_one_file(file_info, overall_bar, slot_bars, slot_queue, process_na
|
||||
]
|
||||
|
||||
if process_name:
|
||||
# 用 executable 指定真实路径,argv[0] 设为别名
|
||||
# 等效于 shell 的: exec -a <process_name> ffmpeg ...
|
||||
ffmpeg_exe = shutil.which("ffmpeg")
|
||||
if not ffmpeg_exe:
|
||||
raise RuntimeError("找不到 ffmpeg 可执行文件")
|
||||
cmd = [process_name] + ffmpeg_args
|
||||
# 用 bash 的 exec -a 重命名 ffmpeg 进程的 argv[0]
|
||||
# ffmpeg 通过 PATH 查找,避免 execve 直接调用 symlink 的兼容问题
|
||||
shell_args = " ".join(shlex.quote(str(a)) for a in ffmpeg_args)
|
||||
proc = subprocess.Popen(
|
||||
cmd,
|
||||
executable=ffmpeg_exe,
|
||||
f"exec -a {shlex.quote(process_name)} ffmpeg {shell_args}",
|
||||
shell=True,
|
||||
executable="/bin/bash",
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
else:
|
||||
cmd = ["ffmpeg"] + ffmpeg_args
|
||||
proc = subprocess.Popen(
|
||||
cmd,
|
||||
["ffmpeg"] + ffmpeg_args,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user