Skip to content

Conversation

@karlkfi
Copy link

@karlkfi karlkfi commented Jun 6, 2025

This change adds the --browser-args option, which takes a slice of strings. These arguments will be passed to the browser command specified with --browser-command. This allows for prepending arguments before the URL.

The primary use case for this feature is to allow opening a browser without needing to make an alias or script to add arguments. For example, "powershell.exe start $URL" allows opening a browser in WSL without needing to access the registry to read the default browser.

On Windows machines with registry access restricted, kubectl oidc-login get-token errors with the error:
ERROR: Registry editing has been disabled by your administrator.. This happens because x-www-browser, an alias to wslview, tries to use reg.exe to read the default browser from the registry.

To work around this error, with this PR, you can configure --browser-command=powershell.exe and --browser-args=start to bypass wslview and launch the browser directly without error.

Note: Some sources say you can use explorer.exe $URL to open a browser, but this always returns error code 1, due to a long standing bug: microsoft/WSL#6565

This change adds the --browser-args option, which takes a slice of strings.
These arguments will be passed to the browser command specified with
--browser-command. This allows for prepending arguments before the URL.

The primary use case for this feature is to allow opening a browser without
needing to make an alias or script to add arguments.
For example, "powershell.exe start $URL" allows opening a browser in WSL
without needing to access the registry to read the default browser.
@karlkfi karlkfi force-pushed the karl-browser-args branch from d99bd36 to 7de5986 Compare June 6, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant