fix: keep auth listener alive when browser fails to open (#89)#92
Merged
Conversation
When open::that() failed (e.g. xdg-open exit 4 on Pop_OS / Cosmic), the ? operator dropped the local TCP listener, so even pasting the auth URL manually couldn't complete the callback. Now we log the failure, print the URL for manual copy, surface a notification, and keep the listener running until the timeout. Refs #89
Daemon-launched logins (from the tray) have no visible stdout, so a notification or log message was easy to miss. Now when open::that() fails on Linux we additionally: - try to copy the URL to the clipboard (wl-copy / xclip) - show a zenity --info dialog with the URL and a hint about clipboard Also print the URL up front (before the open attempt) on all platforms so terminal users always see it, matching cookcli's behaviour. Refs #89
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.
Summary
xdg-openexits with code 4 even when a browser is installed.open::that(&login_url)?propagated the error and dropped the local TCP listener bound on127.0.0.1:<port>, so even pasting the URL manually couldn't complete the OAuth callback.Fallbacks when the browser doesn't open
cookcli loginbehaviour — terminal users see it whether the auto-open works or not.wl-copy/xclipto copy the URL to the clipboard automatically.zenity --infodialog with the URL (selectable text), telling the user whether the clipboard copy succeeded.Test plan
cargo fmtcargo clippy --all-targets -- -D warnings -A dead_codecargo testxdg-open(e.g.PATH=/dev/null cook-sync login) and confirm: URL prints to stdout, zenity dialog appears, clipboard receives URL, callback completes after manual paste.