Verified Solution

[docker/cli] Support BROWSER env variable when selecting a browser to launch for oauth2

Sponsored Content
### ROOT CAUSE The current implementation of the browser launcher in the Docker CLI for Linux systems does not prioritize the `BROWSER` environment variable. The `BROWSER` environment variable is only considered if the hardcoded list of browsers (`xdg-open`, `x-www-browser`, `www-browser`) fails to launch a browser. This change moves the check for the `BROWSER` environment variable to the beginning, so that it takes precedence over the hardcoded list. ### CODE FIX We change the order of the checks in the `Open` method of the `Linux` struct in `vendor/github.com/pkg/browser/browser_linux.go`. The `BROWSER` environment variable is checked first, and if it is set, the corresponding command is used. Otherwise, the hardcoded list of browsers is tried. Here is the fixed code: ```go // First, check the BROWSER environment variable if brow, ok := os.LookupEnv("BROWSER"); ok { if brow != "" { return runCommand(brow, url) } } // Otherwise, try to use xdg-open if available _, err := exec.LookPath("xdg-open") if err == nil { return runCommand("xdg-open", url) } // Otherwise try x-www-browser _, err = exec.LookPath("x-www-browser") if err == nil { return runCommand("x-www-browser", url) } // Otherwise try www-browser _, err = exec.LookPath("www-browser") if err == nil { return runCommand("www-browser", url) } ```
Deploy on DigitalOcean ($200 Credit)

Related Fixes

[pytorch/pytorch] [Bug] NaN gradients in varlen_attn backward pass when input length exceeds cu_seqlens[-1]
[golang/go] runtime: Windows crash with Go 1.26.0, 1.26.1
[rust-lang/rust] `unused_features` triggers on stable `lint_reasons` despite usage