OpenInBrowser opens given URL in your default browser.
(url string)
| 20 | |
| 21 | // OpenInBrowser opens given URL in your default browser. |
| 22 | func OpenInBrowser(url string) error { |
| 23 | fmt.Println("Opening", url, "in browser.") |
| 24 | var err error |
| 25 | switch runtime.GOOS { |
| 26 | case "linux": |
| 27 | err = exec.Command("xdg-open", url).Run() |
| 28 | case "windows": |
| 29 | err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Run() |
| 30 | case "darwin": |
| 31 | err = exec.Command("open", url).Run() |
| 32 | default: |
| 33 | err = errors.New("unsupported platform") |
| 34 | } |
| 35 | return err |
| 36 | } |
| 37 | |
| 38 | // RunUntilEndpointHit stalls current goroutine executions and prints the URL to local address. When URL is hit |
| 39 | // this function returns with nil to continue the execution. It also watches for SIGINT, SIGKILL or SIGHUP signals |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…