feat(node-syncsub): use spawn to follow process stdout
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-03-29 23:06:56 -04:00
parent 3bc5011e6a
commit c9ded1c22d

View file

@ -1,6 +1,6 @@
import { readdir } from 'fs';
import { ffprobe } from 'fluent-ffmpeg';
import { exec } from 'child_process';
import { spawn } from 'child_process';
const SUB_EXT_LENGTH = 7;
@ -38,7 +38,7 @@ const main = () => {
.map((s) => s['tags']['language']);
const cmd = [
'subsync --cli sync',
'--cli sync',
`--sub-lang ${lang}`,
`--ref-stream-by-lang ${availLangs.includes(lang) ? lang : other(lang)}`,
@ -50,12 +50,11 @@ const main = () => {
`--ref '${VIDEO}'`,
// '--overwrite',
].join(' ');
];
exec(cmd, (error, stdout, stderr) => {
console.log(error);
console.log(stdout);
console.log(stderr);
spawn('subsync', cmd, {
shell: true,
stdio: [process.stdin, process.stdout, process.stderr],
});
});
});