Fix progress flags being inserted before nice's own -n flag, breaking every job

-progress pipe:1 -nostats belong to ffmpeg, not nice — they were landing right
after cmd[0] (nice) instead of after the ffmpeg token, which made nice choke
on an unrecognized option and fail before ffmpeg ever started.
This commit is contained in:
Myron Blair
2026-07-27 17:47:25 -05:00
parent 71e731124a
commit 8fa1291e0f
+4 -1
View File
@@ -195,7 +195,10 @@ async def _run(cmd: List[str], on_status, out_dir: Path, entry_filename: str, so
duration = await probe_duration(source) if source else 0.0 duration = await probe_duration(source) if source else 0.0
await on_status("running", progress=0.0) await on_status("running", progress=0.0)
# Machine-readable progress on stdout, separate from ffmpeg's normal stderr logging. # Machine-readable progress on stdout, separate from ffmpeg's normal stderr logging.
cmd = [cmd[0], "-progress", "pipe:1", "-nostats"] + cmd[1:] # Insert right after the "ffmpeg" token, not cmd[0] — cmd is prefixed with `nice -n N`,
# and these flags belong to ffmpeg, not to nice.
ffmpeg_idx = cmd.index("ffmpeg")
cmd = cmd[:ffmpeg_idx + 1] + ["-progress", "pipe:1", "-nostats"] + cmd[ffmpeg_idx + 1:]
try: try:
proc = await asyncio.create_subprocess_exec( proc = await asyncio.create_subprocess_exec(
*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, *cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE,