From be3b69c65cc45ff639688a1d600c767df68ba4c0 Mon Sep 17 00:00:00 2001 From: josc146 Date: Tue, 12 Dec 2023 23:04:24 +0800 Subject: [PATCH] fix v1.6.1 CmdHelper --- backend-golang/file.go | 2 +- backend-golang/utils.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend-golang/file.go b/backend-golang/file.go index 775b083..d3a69f2 100644 --- a/backend-golang/file.go +++ b/backend-golang/file.go @@ -204,6 +204,6 @@ func (a *App) OpenFileFolder(path string, relative bool) error { } func (a *App) StartFile(path string) error { - _, err := CmdHelper(path) + _, err := CmdHelper(true, path) return err } diff --git a/backend-golang/utils.go b/backend-golang/utils.go index b5e7f99..65f5d8f 100644 --- a/backend-golang/utils.go +++ b/backend-golang/utils.go @@ -18,7 +18,7 @@ import ( "syscall" ) -func CmdHelper(args ...string) (*exec.Cmd, error) { +func CmdHelper(hideWindow bool, args ...string) (*exec.Cmd, error) { if runtime.GOOS != "windows" { return nil, errors.New("unsupported OS") } @@ -43,7 +43,7 @@ func CmdHelper(args ...string) (*exec.Cmd, error) { } cmd := exec.Command(cmdHelper, args...) cmd.SysProcAttr = &syscall.SysProcAttr{} - //go:custom_build windows cmd.SysProcAttr.HideWindow = true + //go:custom_build windows cmd.SysProcAttr.HideWindow = hideWindow err = cmd.Start() if err != nil { return nil, err @@ -54,7 +54,7 @@ func CmdHelper(args ...string) (*exec.Cmd, error) { func Cmd(args ...string) (string, error) { switch platform := runtime.GOOS; platform { case "windows": - cmd, err := CmdHelper(args...) + cmd, err := CmdHelper(false, args...) if err != nil { return "", err }