From d5ad4144b5f89c01e421900e77ff865d98a4be11 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 20 Nov 2014 23:47:55 +0800 Subject: better error handling on player quit --- bin/cmd.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/cmd.js b/bin/cmd.js index a8835b4..8c8d1bc 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -258,7 +258,10 @@ function onReady () { var vlcPath = key.InstallDir.value + path.sep + 'vlc' VLC_ARGS = VLC_ARGS.split(' ') VLC_ARGS.unshift(href) - cp.execFile(vlcPath, VLC_ARGS, errorAndExit) + cp.execFile(vlcPath, VLC_ARGS, function (err) { + if (err) return errorAndExit(err) + done() + }) } } else if (argv.vlc) { var root = '/Applications/VLC.app/Contents/MacOS/VLC' @@ -275,10 +278,10 @@ function onReady () { } if (cmd) { - player = cp.exec(cmd, errorAndExit) - .on('exit', function () { - done() - }) + player = cp.exec(cmd, function (err) { + if (err) return errorAndExit(err) + done() + }) } if (argv.airplay) { -- cgit v1.2.3