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.

Commit b98aa3f

Browse files
authored
Merge pull request #12 from codercom/macos
Support google chrome on macOS
2 parents 366561f + 9293ea2 commit b98aa3f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

main.go

+7
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ func openBrowser(url string) {
146146
openCmd = exec.Command("chromium-browser", fmtChromeOptions(url)...)
147147
case commandExists("firefox"):
148148
openCmd = exec.Command("firefox", "--url="+url, "-safe-mode")
149+
case pathExists("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"):
150+
openCmd = exec.Command("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", fmtChromeOptions(url)...)
149151
default:
150152
flog.Info("unable to find a browser to open: sshcode only supports firefox, chrome, and chromium")
151153
}
@@ -166,6 +168,11 @@ func commandExists(name string) bool {
166168
return err == nil
167169
}
168170

171+
func pathExists(name string) bool {
172+
_, err := os.Stat(name)
173+
return err == nil
174+
}
175+
169176
// randomPort picks a random port to start code-server on.
170177
func randomPort() (string, error) {
171178
const (

0 commit comments

Comments
 (0)