make url open escaped on windows
This commit is contained in:
Родитель
6082d6222a
Коммит
bbb4be7e57
4
open.go
4
open.go
|
@ -6,6 +6,7 @@ import (
|
|||
"fmt"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var openCommands = map[string][]string{
|
||||
|
@ -19,6 +20,9 @@ func Open(uri string) error {
|
|||
if !ok {
|
||||
return fmt.Errorf("don't know how to open things on %s platform", runtime.GOOS)
|
||||
}
|
||||
if runtime.GOOS == "windows" {
|
||||
uri = strings.Replace(uri, "&", "^&", -1)
|
||||
}
|
||||
run = append(run, uri)
|
||||
cmd := exec.Command(run[0], run[1:]...)
|
||||
return cmd.Start()
|
||||
|
|
Загрузка…
Ссылка в новой задаче