Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Commit

Permalink
fix: fixed fatal errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 28, 2018
1 parent b9ebb0b commit 88173e0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,17 @@ export default (e: IEventEmitter) => {
try {
const cli: typeof CLI = require('.').cli
if (err.code === 'EPIPE') return
let exit = 1
if (err['cli-ux'] && typeof err['cli-ux'].exit === 'number') {
if (err.code === 'ESIGINT') cli.action.stop(chalk.yellowBright('!'))
else if (err.code !== 'EEXIT') displayError(err)
await cli.done().catch(cli.debug)
process.exit(err['cli-ux'].exit as number)
const c = err['cli-ux'].exit
if (typeof c === 'number') exit = c
} else {
cli.fatal(err)
cli.fatal(err, {exit: false})
}
await cli.done().catch(cli.debug)
process.exit(exit)
} catch (newError) {
console.error(err)
console.error(newError)
Expand Down

0 comments on commit 88173e0

Please sign in to comment.