wails icon indicating copy to clipboard operation
wails copied to clipboard

Is it possible to add a "runtime.Restart()" api

Open zundaren opened this issue 10 months ago • 0 comments

Is your feature request related to a problem? Please describe.

When the automatic upgrade program needs to restart the application, at present I am through the "cmd" way to control, but not elegant enough

Describe the solution you'd like

runtime.Restart()

func Restart() error {
	var cmd string
	if osutil.IsWindows() {
		cmd = strings.Join([]string{"taskkill /pid", u.Str(Pid), "/f", "; start", ProgramPath}, " ")
	} else if osutil.IsMac() {
		cmd = strings.Join([]string{"kill -9", u.Str(Pid), ";", ProgramPath}, " ")
	} else {
		cmd = strings.Join([]string{"kill -9", u.Str(Pid), ";", ProgramPath}, " ")
	}
	return osutil.StartExec(cmd)
}

Describe alternatives you've considered

No response

Additional context

No response

zundaren avatar Apr 18 '24 02:04 zundaren