Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-12-01 04:43:13 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-12-01 04:43:13 +0300
commit3daf1295710b29315573a7afe29c072c35a0e24e (patch)
tree2a0ce5dc4077f77b1daff5ef56901a30f8ec4f5d /bin
parent4d653bad785cfec25ad499db05bcd5b345242414 (diff)
cli: Using Control-C should not print "Unexpected error" message (Fix #497)
Terminating a script with Control-C returns exit code 130 in new versions of node.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/cmd.js23
1 files changed, 12 insertions, 11 deletions
diff --git a/bin/cmd.js b/bin/cmd.js
index c342be3..85958c9 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -19,17 +19,18 @@ process.title = 'WebTorrent'
var expectedError = false
process.on('exit', function (code) {
- if (code !== 0 && !expectedError) {
- clivas.line('\n{red:UNEXPECTED ERROR:} If this is a bug in WebTorrent, report it!')
- clivas.line('{green:OPEN AN ISSUE:} https://github.com/feross/webtorrent/issues\n')
- clivas.line(
- 'DEBUG INFO: ' +
- 'webtorrent ' + require('../package.json').version + ', ' +
- 'node ' + process.version + ', ' +
- process.platform + ' ' + process.arch + ', ' +
- 'exit ' + code
- )
- }
+ if (code === 0 || expectedError) return // normal exit
+ if (code === 130) return // intentional exit with Control-C
+
+ clivas.line('\n{red:UNEXPECTED ERROR:} If this is a bug in WebTorrent, report it!')
+ clivas.line('{green:OPEN AN ISSUE:} https://github.com/feross/webtorrent/issues\n')
+ clivas.line(
+ 'DEBUG INFO: ' +
+ 'webtorrent ' + require('../package.json').version + ', ' +
+ 'node ' + process.version + ', ' +
+ process.platform + ' ' + process.arch + ', ' +
+ 'exit ' + code
+ )
})
process.on('SIGINT', gracefulExit)