From 5a2494adcf56f437995ec82941e0537eb0e5305b Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Tue, 28 May 2019 21:32:03 -0700 Subject: [PATCH] Prevent uncaught exception if spawn() throws synchronously (e.g. ENOMEM) --- package.json | 2 +- src/ffmpeg.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a9c5a063..aff88e87 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.65.2", + "version": "3.65.3", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/src/ffmpeg.js b/src/ffmpeg.js index b8bb0517..31fe9943 100644 --- a/src/ffmpeg.js +++ b/src/ffmpeg.js @@ -336,7 +336,14 @@ exports.ffprobe = function ffprobe(filename, cb) { var childErr; var args = ["-show_streams", "-show_format", filename]; 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 stderr = ""; var timer = setTimeout(function () {