distribution/vendor/github.com/pkg/browser/browser_linux.go
Flavian Missi 7caf058a65
bump azure sdk
v1.3.0 of azidentity introduces support to workload identity.

Signed-off-by: Flavian Missi <fmissi@redhat.com>
2023-05-22 09:05:35 +02:00

21 lines
563 B
Go

package browser
import (
"os/exec"
"strings"
)
func openBrowser(url string) error {
providers := []string{"xdg-open", "x-www-browser", "www-browser"}
// There are multiple possible providers to open a browser on linux
// One of them is xdg-open, another is x-www-browser, then there's www-browser, etc.
// Look for one that exists and run it
for _, provider := range providers {
if _, err := exec.LookPath(provider); err == nil {
return runCmd(provider, url)
}
}
return &exec.Error{Name: strings.Join(providers, ","), Err: exec.ErrNotFound}
}