diff --git a/server/libs/nodeFfprobe/index.js b/server/libs/nodeFfprobe/index.js index a6d78233..ec52ef2a 100644 --- a/server/libs/nodeFfprobe/index.js +++ b/server/libs/nodeFfprobe/index.js @@ -20,7 +20,14 @@ module.exports = (function () { proc.on('exit', code => { exitCode = code }) proc.on('error', err => reject(err)) - proc.on('close', () => resolve(JSON.parse(probeData.join('')))) + proc.on('close', () => { + try { + let result = JSON.parse(probeData.join('')) + resolve(result); + } catch (err) { + reject(err); + } + }) }) }