From 3310e7c09e34aaea09f4180fcb8b6630461de17e Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Thu, 11 Aug 2022 18:50:54 +0000 Subject: [PATCH] fixup! feat(ng-dev): create system for registering functions to be called on command completion --- ng-dev/utils/yargs.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ng-dev/utils/yargs.ts b/ng-dev/utils/yargs.ts index 335f6f168..9be025beb 100644 --- a/ng-dev/utils/yargs.ts +++ b/ng-dev/utils/yargs.ts @@ -27,8 +27,14 @@ export function runParserWithCompletedFunctions(applyConfiguration: (argv: Argv) applyConfiguration(yargs([])).parse( process.argv.slice(2), async (err: Error | null, _: Arguments, output: string) => { + if (err && [undefined, 0].includes(process.exitCode)) { + process.exitCode = 1; + } + if (err) { + Log.debug(err); + } if (output) { - err = new YargsError(); + err = err || new YargsError(); Log.log(output); } for (const completedFunc of completedFunctions) {