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:
@@ -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();
|
||||||
|
|
||||||
|
try {
|
||||||
fs.unlinkSync(outputPath);
|
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...
|
||||||
|
|||||||
Reference in New Issue
Block a user