File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -20,20 +20,21 @@ func Command(url string) (*exec.Cmd, error) {
2020
2121// ForOS produces an exec.Cmd to open the web browser for different OS
2222func ForOS (goos , url string ) * exec.Cmd {
23+ exe := "open"
2324 var args []string
2425 switch goos {
2526 case "darwin" :
26- args = [] string { "open" }
27+ args = append ( args , url )
2728 case "windows" :
28- args = [] string { "cmd" , "/c" , "start" }
29+ exe = "cmd"
2930 r := strings .NewReplacer ("&" , "^&" )
30- url = r .Replace (url )
31+ args = append ( args , "/c" , "start" , r .Replace (url ) )
3132 default :
32- args = []string {"xdg-open" }
33+ exe = "xdg-open"
34+ args = append (args , url )
3335 }
3436
35- args = append (args , url )
36- cmd := exec .Command (args [0 ], args [1 :]... )
37+ cmd := exec .Command (exe , args ... )
3738 cmd .Stderr = os .Stderr
3839 return cmd
3940}
You can’t perform that action at this time.
0 commit comments