Skip to content

fix: non-blocking browser launch in Pi extension (Linux)#292

Merged
backnotprop merged 2 commits into
mainfrom
fix/pi-linux
Mar 15, 2026
Merged

fix: non-blocking browser launch in Pi extension (Linux)#292
backnotprop merged 2 commits into
mainfrom
fix/pi-linux

Conversation

@backnotprop
Copy link
Copy Markdown
Owner

Summary

  • Replace execSync(xdg-open ...) with spawn(..., { detached: true, stdio: "ignore" }).unref() in the Pi extension's openBrowser()
  • execSync blocks the Node.js event loop, so the HTTP server can't respond to the browser's initial page request on Linux desktops where xdg-open doesn't immediately exit — causing a deadlock

Closes #288

Test plan

  • Test on Linux (Wayland/Hyprland) with Chromium — verify page loads without hanging
  • Test on macOS — verify open still works
  • Test with PLANNOTATOR_BROWSER override

🤖 Generated with Claude Code

execSync(xdg-open ...) blocks the Node.js event loop, preventing the
HTTP server from responding to the browser's initial request on Linux
desktops where xdg-open doesn't immediately exit.

Closes #288

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@backnotprop
Copy link
Copy Markdown
Owner Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Reviewed the execSyncspawn().unref() refactor in apps/pi-extension/server.ts. The fix correctly addresses the deadlock described in #288 where xdg-open blocks the Node.js event loop on Linux. All platform branches (macOS, Windows/WSL, Linux) and custom browser env var handling are preserved. Control flow is exhaustive and compiles cleanly under strict mode.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

spawn() reports missing-command failures asynchronously via an 'error'
event. Without a listener, a bad PLANNOTATOR_BROWSER or missing
xdg-open crashes the Pi process. Add child.once("error", () => {})
to swallow it silently, matching the original execSync try/catch
behavior.
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.

Pi extension hangs on Linux because openBrowser() uses blocking execSync(xdg-open ...)

1 participant