Skip to content

Commit

Permalink
hopefully fix call to start
Browse files Browse the repository at this point in the history
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?
  • Loading branch information
splitbrain committed Jun 25, 2024
1 parent 0b56dfe commit 3c28f0e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/setup/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"golang.org/x/sys/windows/registry"
"os"
"os/exec"
"strings"
)

// https://stackoverflow.com/a/3964401
Expand Down Expand Up @@ -79,8 +80,11 @@ func Uninstall() error {
}

func Run(path string) error {
// note: "golocal" is the title for the command window
out, err := exec.Command("cmd", "/C", "start", "golocal", path).CombinedOutput()
path = strings.Replace(path, "/", "\\", -1)

// note: "golocal" is the title for the command window and windows 11 seems to need it
out, err := exec.Command("cmd", "/C", "start", "", "/B", path).CombinedOutput()

if err != nil {
return fmt.Errorf("Failed to execute command.\n%s\n%s", err.Error(), out)
}
Expand Down

0 comments on commit 3c28f0e

Please sign in to comment.