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

Commit 88173e0

Browse files
committed
fix: fixed fatal errors
1 parent b9ebb0b commit 88173e0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/errors.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,17 @@ export default (e: IEventEmitter) => {
146146
try {
147147
const cli: typeof CLI = require('.').cli
148148
if (err.code === 'EPIPE') return
149+
let exit = 1
149150
if (err['cli-ux'] && typeof err['cli-ux'].exit === 'number') {
150151
if (err.code === 'ESIGINT') cli.action.stop(chalk.yellowBright('!'))
151152
else if (err.code !== 'EEXIT') displayError(err)
152-
await cli.done().catch(cli.debug)
153-
process.exit(err['cli-ux'].exit as number)
153+
const c = err['cli-ux'].exit
154+
if (typeof c === 'number') exit = c
154155
} else {
155-
cli.fatal(err)
156+
cli.fatal(err, {exit: false})
156157
}
158+
await cli.done().catch(cli.debug)
159+
process.exit(exit)
157160
} catch (newError) {
158161
console.error(err)
159162
console.error(newError)

0 commit comments

Comments
 (0)