diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2015-12-19 06:04:09 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2015-12-27 23:17:14 +0300 |
commit | d5ba4e0260d21657780c065c71ed3c5648df5944 (patch) | |
tree | 80414c9ad2671e62f9d323b0485f4c50b948f75c /bin/cmd.js | |
parent | 13eaafed2c0563da0d94778d5e22f1bf1f37fb5c (diff) |
style
Diffstat (limited to 'bin/cmd.js')
-rwxr-xr-x | bin/cmd.js | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -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() + }) } |