Repository navigation
fix(device): don't crash when no browser opener is installed - #265
Merged
Merged
Conversation
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
spawn reports a missing opener (xdg-open on a headless box) as an 'error' event, not a throw, and with no listener it crashed the process after dcd device open had printed "Opened the monitor". openBrowser now waits for 'spawn' or 'error' and returns false, so callers print the URL instead. Also corrects CLAUDE.md and the bridge.ts header: the bridge keeps one connection and re-reads auth on every request; it no longer remakes the connection when a session is renewed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
riglar
force-pushed
the
fix/browser-enoent-and-docs
branch
from
October 26, 2026 09:37
42fde10 to
8d05b45
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two comments on #260:
What & why
openBrowsercrashed the CLI when no opener is installedspawndoesn't throw when the program is missing. It emits an'error'event, and with no listener that event crashes the process. So on a headless Linux box withoutxdg-open,dcd device openprinted "Opened the monitor", then died withspawn xdg-open ENOENTand exit 1.openBrowsernow waits for'spawn'or'error', and returnsfalsewhen the opener can't start. It isasyncnow, and both callers (dcd loginanddcd device open)awaitit.false: they print the URL to open by hand, and exit 0.Docs said the bridge remakes its connection on renewal
#261 changed this, but
CLAUDE.mdand thebridge.tsheader still described the old behaviour. Both now say: one shared connection, with the auth re-read fromgetContext()on every request.How to test
startOpenerwith a program that doesn't exist returnsfalseinstead of crashing. It uses a made-up program name, so no test ever starts a real browser.pnpm lint(0 errors),pnpm typecheck,pnpm test:unit(461 passing).🤖 Generated with Claude Code