From 3be0b790585738203b3d6c29ace75427cbd76de5 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 27 Jan 2026 13:09:47 +0100 Subject: [PATCH] fix: call `process.exit` to force shutdown --- src/cli/main.spec.ts | 2 ++ src/cli/main.ts | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cli/main.spec.ts b/src/cli/main.spec.ts index 6c4914a81a..eed4a72d13 100644 --- a/src/cli/main.spec.ts +++ b/src/cli/main.spec.ts @@ -4,6 +4,7 @@ import { main } from './main'; const mocks = vi.hoisted(() => ({ argv0: 'containerbase-cli', argv: ['node', 'containerbase-cli', 'help'], + exit: vi.fn(), })); vi.mock('node:process', async (importOriginal) => ({ @@ -20,5 +21,6 @@ describe('cli/main', () => { test('works', async () => { vi.spyOn(process.stdout, 'write').mockReturnValue(true); expect(await main()).toBeUndefined(); + expect(mocks.exit).toHaveBeenCalled(); }); }); diff --git a/src/cli/main.ts b/src/cli/main.ts index 430fc6d87c..973bf331dc 100644 --- a/src/cli/main.ts +++ b/src/cli/main.ts @@ -1,4 +1,4 @@ -import { argv, argv0, version } from 'node:process'; +import { argv, argv0, exit, version } from 'node:process'; import { Builtins, Cli } from 'clipanion'; import { registerCommands } from './command'; import { bootstrap } from './proxy'; @@ -31,5 +31,6 @@ export async function main(): Promise { registerCommands(cli, mode); - await cli.runExit(args); + // Explicitly call exit to force pino shutdown + exit(await cli.run(args)); }