Skip to content

fix(#212, #378, #395): lifecycle and shutdown improvements#449

Open
giulio-leone wants to merge 1 commit intovercel-labs:mainfrom
giulio-leone:fix/lifecycle-shutdown
Open

fix(#212, #378, #395): lifecycle and shutdown improvements#449
giulio-leone wants to merge 1 commit intovercel-labs:mainfrom
giulio-leone:fix/lifecycle-shutdown

Conversation

@giulio-leone
Copy link

Lifecycle & Shutdown Improvements

Grouped fix for three related lifecycle/shutdown issues.

Changes

#212 — Check browser connection in isLaunched()

  • isLaunched() now calls browser.isConnected() instead of just checking browser !== null
  • Also checks persistent context state so manually-closed browsers are detected correctly

#378 — Prevent hanging Chrome processes on shutdown

  • Reworked shutdown flow in src/daemon.ts with a shuttingDown guard to prevent re-entrant cleanup
  • Added 1 s close timeout → 5 s force-exit fallback to ensure the process never hangs
  • Graceful shutdown kills browser contexts before force-terminating

#395 — Flush stdout before exit to prevent terminal freeze

  • Introduced flush_and_exit() in Rust CLI (cli/src/main.rs) that flushes stdout before calling exit()
  • When stdout is piped (e.g. from Claude Code), full buffering can cause the caller to hang; flushing prevents this

Files Changed

File Issue
src/browser.ts #212
src/daemon.ts #378
cli/src/main.rs #395

Testing

  • npx tsc --noEmit — passes
  • cargo check (cli) — passes

Closes #212, closes #378, closes #395

… shutdown improvements

- vercel-labs#212: Check browser.isConnected() + persistent context state in isLaunched()
- vercel-labs#378: Reworked shutdown with timeouts, force-exit, shuttingDown guard
- vercel-labs#395: flush_and_exit() replaces exit(1) to prevent terminal freeze
@vercel
Copy link
Contributor

vercel bot commented Feb 13, 2026

@g97iulio1609 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant