Skip to content

fix(init): force process exit after wizard completes#782

Merged
betegon merged 1 commit intomainfrom
fix/init-release-stdin-on-exit
Apr 20, 2026
Merged

fix(init): force process exit after wizard completes#782
betegon merged 1 commit intomainfrom
fix/init-release-stdin-on-exit

Conversation

@betegon
Copy link
Copy Markdown
Member

@betegon betegon commented Apr 20, 2026

Summary

  • sentry init hangs after the wizard finishes, requiring Ctrl+C (or, with the partial fix from this branch's earlier iteration, one Enter) to recover the shell prompt
  • Root cause: Bun's global fetch dispatcher (used by MastraClient) holds keep-alive sockets open after requests return, keeping the libuv loop alive past the wizard. There's no clean programmatic close for it.
  • Fix: explicit `process.exit(process.exitCode ?? 0)` at the end of `init` command's `func`. `init` is a terminal command, `process.exit` flushes stdio before exiting, and the OS releases the lingering handles unconditionally.

Fixes #780.

Test plan

  • `cat /tmp/install-local | SENTRY_INIT=1 bash` (curl|bash repro) — shell prompt returns immediately, no Enter or Ctrl+C
  • Wizard cancel path (Ctrl-C at confirm prompt) — exits cleanly
  • `bun run lint` — clean (only pre-existing warning in markdown.ts)
  • `bun run typecheck` — passes

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 20, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (issue) Add resolve, unresolve (reopen), and merge commands by BYK in #778

Bug Fixes 🐛

  • (error-reporting) Fall back to message prefix for ValidationError without field by BYK in #776
  • (hex-id) Auto-recover malformed hex IDs in view commands (CLI-16G) by BYK in #777
  • (init) Force process exit after wizard completes by betegon in #782

Internal Changes 🔧

  • (init) Trim deprecated --features help entries by MathurAditya724 in #781
  • Regenerate docs by github-actions[bot] in 58a84035

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 20, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-782/

Built to branch gh-pages at 2026-04-20 11:42 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Comment thread src/commands/init.ts
@betegon betegon force-pushed the fix/init-release-stdin-on-exit branch from e8dc024 to 5152bf1 Compare April 20, 2026 11:35
`sentry init` is a terminal command, but Bun's global fetch dispatcher
(used by MastraClient) holds keep-alive sockets open after requests
return, leaving the libuv loop alive and the shell hung after the wizard
finishes. Manifests in `curl | bash` SENTRY_INIT=1 flows where the user
has to press Ctrl+C to recover the prompt.

Fixes #780.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@betegon betegon force-pushed the fix/init-release-stdin-on-exit branch from 5152bf1 to 8c6722a Compare April 20, 2026 11:42
@github-actions
Copy link
Copy Markdown
Contributor

Codecov Results 📊

138 passed | Total: 138 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 1705 uncovered lines.
✅ Project coverage is 95.53%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    95.50%    95.53%    +0.03%
==========================================
  Files          262       262         —
  Lines        38170     38173        +3
  Branches         0         0         —
==========================================
+ Hits         36454     36468       +14
- Misses        1716      1705       -11
- Partials         0         0         —

Generated by Codecov Action

@betegon betegon merged commit ce27678 into main Apr 20, 2026
23 checks passed
@betegon betegon deleted the fix/init-release-stdin-on-exit branch April 20, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SENTRY_INIT=1 via curl | bash hangs after wizard completes, requires Ctrl+C

1 participant