From d107c8ddbd0d2f02506c94801dc5736cd4b36a9d Mon Sep 17 00:00:00 2001 From: Torleif Halseth Date: Thu, 7 May 2026 10:31:52 +0200 Subject: [PATCH 1/2] fix(core): exit process after successful build When running `storybook build`, the process hangs after completing because open handles (e.g. telemetry, watchers) keep the event loop alive. Add `process.exit(0)` after the success log to ensure the CLI exits cleanly. Closes #34446 --- code/core/src/bin/core.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/code/core/src/bin/core.ts b/code/core/src/bin/core.ts index 9ce0413d9bcb..9109539984a8 100644 --- a/code/core/src/bin/core.ts +++ b/code/core/src/bin/core.ts @@ -189,6 +189,7 @@ command('build') }); logger.outro('Storybook build completed successfully'); + process.exit(0); }); command('index') From 9bfb9f3ffdb32010d2d08b31eeec605dc810bb27 Mon Sep 17 00:00:00 2001 From: Torleif Halseth Date: Thu, 7 May 2026 13:01:12 +0200 Subject: [PATCH 2/2] fix: move process.exit(0) to postAction hook to preserve --logfile support --- code/core/src/bin/core.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/core/src/bin/core.ts b/code/core/src/bin/core.ts index 9109539984a8..445e1f63484e 100644 --- a/code/core/src/bin/core.ts +++ b/code/core/src/bin/core.ts @@ -77,6 +77,9 @@ const command = (name: string) => logger.outro(`Debug logs are written to: ${logFile}`); } catch {} } + if (command.name() === 'build') { + process.exit(0); + } }); command('dev') @@ -189,7 +192,6 @@ command('build') }); logger.outro('Storybook build completed successfully'); - process.exit(0); }); command('index')