From 137c9b648ff4cccdddc8660890b1a1328e662441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20K=C3=A4m=C3=A4r=C3=A4inen?= Date: Mon, 26 Feb 2018 17:04:48 +0200 Subject: [PATCH] Listen for ffmpeg 'close' event instead of 'exit'. Allows the ffmpeg process stdout stream (ie. the piped sample) to be fully processed always even if the system is under heavy load. --- audiosprite.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audiosprite.js b/audiosprite.js index d06adb5..e855460 100755 --- a/audiosprite.js +++ b/audiosprite.js @@ -115,7 +115,7 @@ module.exports = function(files) { let ffmpeg = spawn('ffmpeg', ['-i', path.resolve(src)] .concat(wavArgs).concat('pipe:')) ffmpeg.stdout.pipe(fs.createWriteStream(dest, {flags: 'w'})) - ffmpeg.on('exit', function(code, signal) { + ffmpeg.on('close', function(code, signal) { if (code) { return cb({ msg: 'File could not be added',