fix v1.6.1 CmdHelper

This commit is contained in:
josc146 2023-12-12 23:04:24 +08:00
parent 07cab6949e
commit be3b69c65c
2 changed files with 4 additions and 4 deletions

View File

@ -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
}

View File

@ -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
}