Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 17, 2021. It is now read-only.

Support google chrome on macOS #12

Merged
merged 1 commit into from
Apr 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand All @@ -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 (
Expand Down