fix windows cmd waiting
This commit is contained in:
parent
556b667cc0
commit
da632565d5
@ -204,6 +204,10 @@ func (a *App) OpenFileFolder(path string, relative bool) error {
|
||||
}
|
||||
|
||||
func (a *App) StartFile(path string) error {
|
||||
_, err := CmdHelper(true, path)
|
||||
cmd, err := CmdHelper(true, path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = cmd.Start()
|
||||
return err
|
||||
}
|
||||
|
@ -44,21 +44,20 @@ func CmdHelper(hideWindow bool, args ...string) (*exec.Cmd, error) {
|
||||
cmd := exec.Command(cmdHelper, args...)
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{}
|
||||
//go:custom_build windows cmd.SysProcAttr.HideWindow = hideWindow
|
||||
err = cmd.Start()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return cmd, nil
|
||||
}
|
||||
|
||||
func Cmd(args ...string) (string, error) {
|
||||
switch platform := runtime.GOOS; platform {
|
||||
case "windows":
|
||||
cmd, err := CmdHelper(false, args...)
|
||||
cmd, err := CmdHelper(true, args...)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
_, err = cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
cmd.Wait()
|
||||
return "", nil
|
||||
case "darwin":
|
||||
ex, err := os.Executable()
|
||||
|
Loading…
Reference in New Issue
Block a user