Sha256: 0df707d84105ede8a99632102a541f3c721f7b6a7c97af65699fe7e78f4d94b5

Contents?: true

Size: 563 Bytes

Versions: 16

Compression:

Stored size: 563 Bytes

Contents

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}
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby_snowflake_client-1.3.7 ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.3.6 ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.3.5 ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.3.4 ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.3.4.pre.debug ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.3.3.pre.debug ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.3.2 ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.3.1 ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.3.0 ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.2.1 ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.2.0 ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.1.1 ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.1.0 ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.0.2 ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.0.1 ext/vendor/github.com/pkg/browser/browser_linux.go
ruby_snowflake_client-1.0.0 ext/vendor/github.com/pkg/browser/browser_linux.go