diff --git a/src/command.ts b/src/command.ts index d1cfee868..b0d0c3ef5 100644 --- a/src/command.ts +++ b/src/command.ts @@ -224,7 +224,7 @@ export default abstract class Command { return Parser.parse(argv, opts) } - protected async catch(err: Record): Promise { + protected async catch(err: Error & {exitCode?: number}): Promise { process.exitCode = process.exitCode ?? err.exitCode ?? 1 if (this.jsonEnabled()) { CliUx.ux.styledJSON(this.toErrorJson(err))