Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: Using Control-C should not print "Unexpected error" message (Fix #497) #498

Merged
merged 1 commit into from Dec 2, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -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)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.