Skip to content

Commit 3c28f0e

Browse files
committed
hopefully fix call to start
on windows 10, the title seems to be optional. But when given needs to be wrapped in quotes which seems impossible when using exec.Command. On windows 11 it seems to be required but not caring about quotes? WTF Microsoft?
1 parent 0b56dfe commit 3c28f0e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/setup/windows.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"golang.org/x/sys/windows/registry"
99
"os"
1010
"os/exec"
11+
"strings"
1112
)
1213

1314
// https://stackoverflow.com/a/3964401
@@ -79,8 +80,11 @@ func Uninstall() error {
7980
}
8081

8182
func Run(path string) error {
82-
// note: "golocal" is the title for the command window
83-
out, err := exec.Command("cmd", "/C", "start", "golocal", path).CombinedOutput()
83+
path = strings.Replace(path, "/", "\\", -1)
84+
85+
// note: "golocal" is the title for the command window and windows 11 seems to need it
86+
out, err := exec.Command("cmd", "/C", "start", "", "/B", path).CombinedOutput()
87+
8488
if err != nil {
8589
return fmt.Errorf("Failed to execute command.\n%s\n%s", err.Error(), out)
8690
}

0 commit comments

Comments
 (0)