From 3c28f0ee652e415388ec27a7d9411f45df51d275 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 25 Jun 2024 12:48:31 +0200 Subject: [PATCH] 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? --- src/setup/windows.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/setup/windows.go b/src/setup/windows.go index d71a95b..ee1bf27 100644 --- a/src/setup/windows.go +++ b/src/setup/windows.go @@ -8,6 +8,7 @@ import ( "golang.org/x/sys/windows/registry" "os" "os/exec" + "strings" ) // https://stackoverflow.com/a/3964401 @@ -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) }