🐛 fix(av1-transfer): find sh dynamically via shutil.which
/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 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,7 @@ import ctypes
|
|||||||
import ctypes.util
|
import ctypes.util
|
||||||
import queue
|
import queue
|
||||||
import shlex
|
import shlex
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
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]
|
# 用 bash 的 exec -a 重命名 ffmpeg 进程的 argv[0]
|
||||||
# ffmpeg 通过 PATH 查找,避免 execve 直接调用 symlink 的兼容问题
|
# ffmpeg 通过 PATH 查找,避免 execve 直接调用 symlink 的兼容问题
|
||||||
shell_args = " ".join(shlex.quote(str(a)) for a in ffmpeg_args)
|
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(
|
proc = subprocess.Popen(
|
||||||
f"exec -a {shlex.quote(process_name)} ffmpeg {shell_args}",
|
f"exec -a {shlex.quote(process_name)} ffmpeg {shell_args}",
|
||||||
shell=True,
|
shell=True,
|
||||||
|
executable=sh,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user