Skip to content

Isaacs/fix tests and fail properly #1719

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

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove reliance on the _exit pseudo-config in error handler
This flag no longer exists.  We just always exit now when we're done.
  • Loading branch information
isaacs committed Aug 24, 2020
commit 9f200abb94ea2127d9a104c225159b1b7080c82c
16 changes: 5 additions & 11 deletions lib/utils/error-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,17 @@ process.on('exit', code => {
wroteLogFile = false
}

const doExit = npm.config && npm.config.loaded && npm.config.get('_exit')
if (doExit) {
// actually exit.
if (exitCode === 0 && !itWorked) {
exitCode = 1
}
if (exitCode !== 0) process.exit(exitCode)
} else {
itWorked = false // ready for next exit
// actually exit.
if (exitCode === 0 && !itWorked) {
exitCode = 1
}
if (exitCode !== 0) process.exit(exitCode)
})

const exit = (code, noLog) => {
exitCode = exitCode || process.exitCode || code

const doExit = npm.config && npm.config.loaded ? npm.config.get('_exit') : true
log.verbose('exit', [code, doExit])
log.verbose('exit', code)
if (log.level === 'silent') noLog = true

const reallyExit = (er) => {
Expand Down