From df63716a23126145793368ac08358b21eeba154f Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 21 Aug 2023 11:12:32 +0200 Subject: [PATCH] . --- lib/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/index.js b/lib/index.js index f1d9bf0..3979617 100644 --- a/lib/index.js +++ b/lib/index.js @@ -27,6 +27,8 @@ ttyStream.isTTY = true */ let exitCode +let forceExit = false + process.on('exit', onexit) // Handle uncaught errors, such as from unexpected async behaviour. @@ -122,6 +124,10 @@ export function args(options) { subscribe(context) } } + + if (forceExit) { + onexit() + } } // Clean the watcher. @@ -175,7 +181,9 @@ export function args(options) { if (output === true) { state.engine.output = output state.args.watch = false + forceExit = true engine(state.engine, done) + } else { onexit() } }