diff --git a/main.go b/main.go index 168d7cf..cf0d82b 100644 --- a/main.go +++ b/main.go @@ -146,6 +146,8 @@ func openBrowser(url string) { openCmd = exec.Command("chromium-browser", fmtChromeOptions(url)...) case commandExists("firefox"): openCmd = exec.Command("firefox", "--url="+url, "-safe-mode") + case pathExists("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"): + openCmd = exec.Command("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", fmtChromeOptions(url)...) default: flog.Info("unable to find a browser to open: sshcode only supports firefox, chrome, and chromium") } @@ -166,6 +168,11 @@ func commandExists(name string) bool { return err == nil } +func pathExists(name string) bool { + _, err := os.Stat(name) + return err == nil +} + // randomPort picks a random port to start code-server on. func randomPort() (string, error) { const (