mirror of
https://github.com/snobu/destreamer.git
synced 2026-01-16 21:12:13 +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:
@@ -194,13 +194,21 @@ async function downloadVideo(videoUrls: string[], outputDirectories: string[], s
|
||||
|
||||
ffmpegCmd.on('error', (error: any) => {
|
||||
pbar.stop();
|
||||
fs.unlinkSync(outputPath);
|
||||
|
||||
try {
|
||||
fs.unlinkSync(outputPath);
|
||||
} catch (e) {}
|
||||
|
||||
console.log(`\nffmpeg returned an error: ${error.message}`);
|
||||
process.exit(ERROR_CODE.UNK_FFMPEG_ERROR);
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
pbar.stop();
|
||||
|
||||
try {
|
||||
fs.unlinkSync(outputPath);
|
||||
} catch (e) {}
|
||||
});
|
||||
|
||||
// let the magic begin...
|
||||
|
||||
Reference in New Issue
Block a user