From f969ff318a285b6454df64648c809452fe82df3b Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdxcode@users.noreply.github.com> Date: Fri, 19 Jan 2018 12:13:50 -0800 Subject: [PATCH] fix: only handle errors once --- src/config.ts | 1 + src/errors.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/config.ts b/src/config.ts index e9bcdbf0..ed4d4de6 100644 --- a/src/config.ts +++ b/src/config.ts @@ -25,6 +25,7 @@ export class Config extends Rx.Subject { 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) { diff --git a/src/errors.ts b/src/errors.ts index 9573afbc..b4a85da2 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -76,6 +76,8 @@ export default function (o: Rx.Subject): Rx.Observable { } function handleUnhandleds() { + if (config.errorsHandled) return + config.errorsHandled = true process.once('SIGINT', () => { const cli = new CLI('SIGINT') const err: NodeJS.ErrnoException = new Error()