MCPcopy Create free account
hub / github.com/basecamp/hey-cli / openBrowser

Function openBrowser

internal/auth/browser.go:11–30  ·  view source on GitHub ↗

openBrowser opens the specified URL in the default browser.

(url string)

Source from the content-addressed store, hash-verified

9
10// openBrowser opens the specified URL in the default browser.
11func openBrowser(url string) error {
12 var cmd string
13 var args []string
14
15 switch runtime.GOOS {
16 case "darwin":
17 cmd = "open"
18 args = []string{url}
19 case "linux":
20 cmd = "xdg-open"
21 args = []string{url}
22 case "windows":
23 cmd = "rundll32"
24 args = []string{"url.dll,FileProtocolHandler", url}
25 default:
26 return fmt.Errorf("unsupported platform: %s", runtime.GOOS)
27 }
28
29 return exec.CommandContext(context.Background(), cmd, args...).Start() //nolint:gosec // intentional: opens user's browser
30}

Callers 1

waitForCallbackMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected