fix: check exitCode in openBrowser() and reinit readline after @clack/prompts (#1782)

openBrowser() never checked the exitCode from Bun.spawnSync, so it silently
returned success even when the browser command failed (headless VMs, no
DISPLAY). Now checks exitCode and always shows the URL as fallback.

selectFromList() uses @clack/prompts which creates/destroys its own readline
on stdin. After it finishes, the shared readline in ui.ts can be corrupted
(Bun #1707). Now explicitly closes and nulls the shared readline after
@clack/prompts returns so the next prompt() call gets a fresh one.

Fixes #1770

Agent: ux-engineer

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
A 2026-02-22 20:21:06 -08:00 committed by GitHub
parent abe1f33318
commit 3988ffe90e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@openrouter/spawn",
"version": "0.7.2",
"version": "0.7.3",
"type": "module",
"bin": {
"spawn": "cli.js"