CLI: Exit process after successful build#34735
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe shared CLI postAction hook now calls process.exit(0) early when the executed command name is ChangesBuild Command Exit Behavior
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@code/core/src/bin/core.ts`:
- Around line 191-192: The explicit process.exit(0) after logger.outro prevents
the shared postAction hook from running and breaks --logfile; remove the direct
call to process.exit(0) in the build flow (the code block containing
logger.outro('Storybook build completed successfully')) and instead return
normally from the build action so the postAction function (the shared postAction
hook invoked elsewhere) can run and write debug logs; if an immediate exit is
truly required, invoke postAction manually before calling process.exit, but
prefer removing process.exit(0) so postAction executes naturally.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5d59d107-c3d6-40de-bb98-99ace3eccd54
📒 Files selected for processing (1)
code/core/src/bin/core.ts
d83285d to
6b4d21a
Compare
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 storybookjs#34446
23835ad to
9bfb9f3
Compare
Closes #34446
What I did
When running
storybook build, the process hangs after completing because open handles (e.g. telemetry, watchers) keep the event loop alive. This addsprocess.exit(0)after the success log to ensure the CLI exits cleanly.This is a minimal, targeted fix: once the build completes and the success message is logged, we explicitly exit the process rather than waiting for all handles to be released.
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Caution
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
yarn storybook buildin a project (or sandbox)Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>Summary by CodeRabbit