Add --browser-args option #1351
Open
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.
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 becausex-www-browser
, an alias towslview
, tries to usereg.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 bypasswslview
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