1
0
mirror of https://github.com/snobu/destreamer.git synced 2026-01-17 05:22:18 +00:00

Delete video file on SIGINT too and silence ENOENT error (#67)

Co-authored-by: kylon <kylonux@gmail.com>
This commit is contained in:
kylon
2020-04-16 18:36:36 +02:00
committed by GitHub
parent d89c0eea8c
commit 3b48221d27

View File

@@ -194,13 +194,21 @@ async function downloadVideo(videoUrls: string[], outputDirectories: string[], s
ffmpegCmd.on('error', (error: any) => { ffmpegCmd.on('error', (error: any) => {
pbar.stop(); pbar.stop();
fs.unlinkSync(outputPath);
try {
fs.unlinkSync(outputPath);
} catch (e) {}
console.log(`\nffmpeg returned an error: ${error.message}`); console.log(`\nffmpeg returned an error: ${error.message}`);
process.exit(ERROR_CODE.UNK_FFMPEG_ERROR); process.exit(ERROR_CODE.UNK_FFMPEG_ERROR);
}); });
process.on('SIGINT', () => { process.on('SIGINT', () => {
pbar.stop(); pbar.stop();
try {
fs.unlinkSync(outputPath);
} catch (e) {}
}); });
// let the magic begin... // let the magic begin...