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

Commit

Permalink
fix: only handle errors once
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 19, 2018
1 parent 11375af commit f969ff3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class Config extends Rx.Subject<ConfigMessage> {
outputLevel: Levels = 'info'
debug = process.env.DEBUG === '*'
action: ActionBase = new Action()
errorsHandled = false

get errlog(): string | undefined { return globals.errlog }
set errlog(errlog: string | undefined) {
Expand Down
2 changes: 2 additions & 0 deletions src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export default function (o: Rx.Subject<Message>): Rx.Observable<any> {
}

function handleUnhandleds() {
if (config.errorsHandled) return
config.errorsHandled = true
process.once('SIGINT', () => {
const cli = new CLI('SIGINT')
const err: NodeJS.ErrnoException = new Error()
Expand Down

0 comments on commit f969ff3

Please sign in to comment.