mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 12:01:42 +08:00
Better handling of process in wails dev
This commit is contained in:
parent
8be2a39daf
commit
46ea3e6074
@ -39,12 +39,7 @@ func (p *Process) Start() error {
|
|||||||
|
|
||||||
go func(cmd *exec.Cmd, running *bool, logger *clilogger.CLILogger, exitChannel chan bool) {
|
go func(cmd *exec.Cmd, running *bool, logger *clilogger.CLILogger, exitChannel chan bool) {
|
||||||
logger.Println("Starting process (PID: %d)", cmd.Process.Pid)
|
logger.Println("Starting process (PID: %d)", cmd.Process.Pid)
|
||||||
err := cmd.Wait()
|
_ = cmd.Wait()
|
||||||
if err != nil {
|
|
||||||
if err.Error() != "signal: killed" {
|
|
||||||
logger.Fatal("Fatal error from app: " + err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logger.Println("Exiting process (PID: %d)", cmd.Process.Pid)
|
logger.Println("Exiting process (PID: %d)", cmd.Process.Pid)
|
||||||
*running = false
|
*running = false
|
||||||
exitChannel <- true
|
exitChannel <- true
|
||||||
@ -59,6 +54,13 @@ func (p *Process) Kill() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
err := p.cmd.Process.Kill()
|
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
|
// Wait for command to exit properly
|
||||||
<-p.exitChannel
|
<-p.exitChannel
|
||||||
|
Loading…
Reference in New Issue
Block a user