Skip to content

Commit

Permalink
Fix: process.exitCode is being set to an object instead of a number
Browse files Browse the repository at this point in the history
  • Loading branch information
eLyiN committed Jul 3, 2024
1 parent 6ab54a3 commit ba547a2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sources/advanced/Cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,9 @@ export class Cli<Context extends BaseContext = BaseContext> implements Omit<Mini
async runExit(input: Command<Context> | Array<string>, context: VoidIfEmpty<Omit<Context, keyof BaseContext>>): Promise<void>;
async runExit(input: Command<Context> | Array<string>, context: MakeOptional<Context, keyof BaseContext>): Promise<void>;
async runExit(input: Command<Context> | Array<string>, context: any) {
process.exitCode = await this.run(input, context);
const result = await this.run(input, context);
const exitCode = typeof result === 'number' ? result : (result && result.code) || 1;
process.exitCode = exitCode;
}

definition(commandClass: CommandClass<Context>, {colored = false}: {colored?: boolean} = {}): Definition | null {
Expand Down

0 comments on commit ba547a2

Please sign in to comment.