fix yt-dlp helper review feedback

This commit is contained in:
2026-04-03 13:09:38 -07:00
parent 2d01dc097b
commit b3645a78a5

View File

@@ -90,6 +90,9 @@ process.exit(0);
`; `;
fs.writeFileSync(scriptPath, script, 'utf8'); fs.writeFileSync(scriptPath, script, 'utf8');
fs.chmodSync(scriptPath, 0o755); fs.chmodSync(scriptPath, 0o755);
if (process.platform === 'win32') {
fs.writeFileSync(scriptPath + '.cmd', `@echo off\r\nbun "${scriptPath}" %*\r\n`, 'utf8');
}
return scriptPath; return scriptPath;
} }
@@ -132,7 +135,7 @@ if [ -n "$YTDLP_EXPECT_SUB_LANG" ] && [ "$sub_lang" != "$YTDLP_EXPECT_SUB_LANG"
exit 4 exit 4
fi fi
prefix="$(printf '%s' "$output_template" | sed 's/%\.%(ext)s$//')" prefix="$(printf '%s' "$output_template" | sed 's/\.%(ext)s$//')"
if [ -z "$prefix" ]; then if [ -z "$prefix" ]; then
exit 1 exit 1
fi fi
@@ -214,7 +217,6 @@ async function withFakeYtDlpCommand<T>(
return await withTempDir(async (root) => { return await withTempDir(async (root) => {
const binDir = path.join(root, 'bin'); const binDir = path.join(root, 'bin');
fs.mkdirSync(binDir, { recursive: true }); fs.mkdirSync(binDir, { recursive: true });
makeFakeYtDlpScript(binDir);
const originalPath = process.env.PATH; const originalPath = process.env.PATH;
const originalCommand = process.env.SUBMINER_YTDLP_BIN; const originalCommand = process.env.SUBMINER_YTDLP_BIN;