From af3c55d3c72cced3746af30f5ca4f8809cc48560 Mon Sep 17 00:00:00 2001 From: FlintyLemming Date: Sat, 28 Feb 2026 11:14:23 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(av1-transfer):=20find=20sh?= =?UTF-8?q?=20dynamically=20via=20shutil.which?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /bin/sh doesn't exist on this system, sh is at /usr/bin/sh. Use shutil.which to locate the shell at runtime. Co-Authored-By: Claude Sonnet 4.6 --- av1-transfer/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/av1-transfer/main.py b/av1-transfer/main.py index c7ba88b..6c021e2 100644 --- a/av1-transfer/main.py +++ b/av1-transfer/main.py @@ -21,6 +21,7 @@ import ctypes import ctypes.util import queue import shlex +import shutil import subprocess import sys from concurrent.futures import ThreadPoolExecutor, as_completed @@ -133,9 +134,11 @@ def transcode_one_file(file_info, overall_bar, slot_bars, slot_queue, process_na # 用 bash 的 exec -a 重命名 ffmpeg 进程的 argv[0] # ffmpeg 通过 PATH 查找,避免 execve 直接调用 symlink 的兼容问题 shell_args = " ".join(shlex.quote(str(a)) for a in ffmpeg_args) + sh = shutil.which("sh") or shutil.which("bash") or "/usr/bin/sh" proc = subprocess.Popen( f"exec -a {shlex.quote(process_name)} ffmpeg {shell_args}", shell=True, + executable=sh, stdout=subprocess.PIPE, stderr=subprocess.PIPE, )