MCPcopy Create free account
hub / github.com/divan/gotrace / StartBrowser

Function StartBrowser

web.go:85–99  ·  view source on GitHub ↗

StartBrowser tries to open the URL in a browser and reports whether it succeeds. Orig. code: golang.org/x/tools/cmd/cover/html.go

(url string)

Source from the content-addressed store, hash-verified

83//
84// Orig. code: golang.org/x/tools/cmd/cover/html.go
85func StartBrowser(url string) bool {
86 // try to start the browser
87 var args []string
88 switch runtime.GOOS {
89 case "darwin":
90 args = []string{"open"}
91 case "windows":
92 args = []string{"cmd", "/c", "start"}
93 default:
94 args = []string{"xdg-open"}
95 }
96 cmd := exec.Command(args[0], append(args[1:], url)...)
97 fmt.Println("If browser window didn't appear, please go to this url:", url)
98 return cmd.Start() == nil
99}

Callers 1

StartServerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected