From d5ba4e0260d21657780c065c71ed3c5648df5944 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Sat, 19 Dec 2015 16:04:09 +1300 Subject: style --- bin/cmd.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'bin') diff --git a/bin/cmd.js b/bin/cmd.js index 52a34a5..f65452f 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -617,13 +617,15 @@ function gracefulExit () { clivas.line('\n{green:webtorrent is gracefully exiting...}') - if (client) { - if (argv['on-exit']) cp.exec(argv['on-exit']).unref() - client.destroy(function (err) { - if (err) return fatalError(err) - // Quit after 1 second. This shouldn't be necessary, node never quits even though - // there's nothing in the event loop when `wrtc` (webtorrent-hybrid) is used :( - setTimeout(function () { process.exit(0) }, 1000).unref() - }) - } + if (!client) return + + if (argv['on-exit']) cp.exec(argv['on-exit']).unref() + + client.destroy(function (err) { + if (err) return fatalError(err) + + // Quit after 1 second. This is only necessary for `webtorrent-hybrid` since + // the `wrtc` package makes node never quit :( + setTimeout(function () { process.exit(0) }, 1000).unref() + }) } -- cgit v1.2.3