5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 23:39:21 +08:00

Better handling of process in wails dev

This commit is contained in:
Lea Anthony 2021-05-18 21:22:52 +10:00
parent 8be2a39daf
commit 46ea3e6074

View File

@ -39,12 +39,7 @@ func (p *Process) Start() error {
go func(cmd *exec.Cmd, running *bool, logger *clilogger.CLILogger, exitChannel chan bool) {
logger.Println("Starting process (PID: %d)", cmd.Process.Pid)
err := cmd.Wait()
if err != nil {
if err.Error() != "signal: killed" {
logger.Fatal("Fatal error from app: " + err.Error())
}
}
_ = cmd.Wait()
logger.Println("Exiting process (PID: %d)", cmd.Process.Pid)
*running = false
exitChannel <- true
@ -59,6 +54,13 @@ func (p *Process) Kill() error {
return nil
}
err := p.cmd.Process.Kill()
if err != nil {
return err
}
err = p.cmd.Process.Release()
if err != nil {
return err
}
// Wait for command to exit properly
<-p.exitChannel