Prevent uncaught exception if spawn() throws synchronously (e.g. ENOMEM)

This commit is contained in:
Calvin Montgomery 2019-05-28 21:32:03 -07:00
parent 6b2dfa483c
commit 5a2494adcf
2 changed files with 9 additions and 2 deletions

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "3.65.2", "version": "3.65.3",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },

View File

@ -336,7 +336,14 @@ exports.ffprobe = function ffprobe(filename, cb) {
var childErr; var childErr;
var args = ["-show_streams", "-show_format", filename]; var args = ["-show_streams", "-show_format", filename];
if (USE_JSON) args = ["-of", "json"].concat(args); if (USE_JSON) args = ["-of", "json"].concat(args);
var child = spawn(Config.get("ffmpeg.ffprobe-exec"), args); let child;
try {
child = spawn(Config.get("ffmpeg.ffprobe-exec"), args);
} catch (error) {
LOGGER.error("Unable to spawn() ffprobe process: %s", error.stack);
cb(error);
return;
}
var stdout = ""; var stdout = "";
var stderr = ""; var stderr = "";
var timer = setTimeout(function () { var timer = setTimeout(function () {