fix(login): continue when browser launch fails - #1111
Open
atyrode wants to merge 3 commits into
Open
Conversation
hsablonniere
requested changes
Jul 15, 2026
hsablonniere
left a comment
Member
There was a problem hiding this comment.
Thanks @atyrode, solid fix. I went and checked how a few other CLIs handle this case (gh, gcloud) and left some suggestions inline.
Co-authored-by: Hubert SABLONNIÈRE <hubert.sablonniere@gmail.com>
Author
|
Thanks! I applied both suggestions. GitHub’s batch application introduced mixed line endings in the changed block, so I added a formatting-only commit to normalize them. npm run validate passes. |
Open
10 tasks
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.
Refs #939
Context
clever loginopens the Console login URL and then polls the OAuth endpoint. Withopen@10.2.0and{ wait: false },open()returns a detachedChildProcesswithout installing anerrorlistener.On a packaged headless Linux/Nix installation without
xdg-open:In bundled Linux builds, if the system
xdg-openis missing, the child emits an asynchronousENOENTevent. That event was unhandled, so Node terminated the CLI before OAuth polling could continue. Catching only the awaitedopen()call does not handle the later child-process event.Solution
Handle both browser-launch failure paths at the existing login call site:
errorlistener to the returned child process;The change remains local to login and preserves
{ wait: false }. It does not change polling, cancellation, authentication, timeouts, the shared browser helper, launcher exit-code handling, or process lifetime. The launch error is intentionally not logged because its spawn arguments can contain the credential-bearing login URL.How to test
npm run validatexdg-openagainst loopback-only API and Console endpoints;1;The packaged Linux reproduction passes. The original Windows report remains unverified; please add the
build:winlabel so the reporter can test a Windows preview.Optional regression coverage
Three dependency-free helper tests are available separately if maintainers want to adopt a test entry point. They are intentionally not part of this source-only PR: