Skip to content

Commit c055fb8

Browse files
authored
fix: call process.exit to force shutdown (#5820)
1 parent 15520d6 commit c055fb8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/cli/main.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { main } from './main';
44
const mocks = vi.hoisted(() => ({
55
argv0: 'containerbase-cli',
66
argv: ['node', 'containerbase-cli', 'help'],
7+
exit: vi.fn(),
78
}));
89

910
vi.mock('node:process', async (importOriginal) => ({
@@ -20,5 +21,6 @@ describe('cli/main', () => {
2021
test('works', async () => {
2122
vi.spyOn(process.stdout, 'write').mockReturnValue(true);
2223
expect(await main()).toBeUndefined();
24+
expect(mocks.exit).toHaveBeenCalled();
2325
});
2426
});

src/cli/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { argv, argv0, version } from 'node:process';
1+
import { argv, argv0, exit, version } from 'node:process';
22
import { Builtins, Cli } from 'clipanion';
33
import { registerCommands } from './command';
44
import { bootstrap } from './proxy';
@@ -31,5 +31,6 @@ export async function main(): Promise<void> {
3131

3232
registerCommands(cli, mode);
3333

34-
await cli.runExit(args);
34+
// Explicitly call exit to force pino shutdown
35+
exit(await cli.run(args));
3536
}

0 commit comments

Comments
 (0)