Fix restart after program has died

This commit is contained in:
Zoe
2025-10-06 14:43:33 +00:00
parent f52a61b9ea
commit a62bfdb01d
2 changed files with 6 additions and 1 deletions

View File

@@ -194,6 +194,11 @@ func (s *Script) Stop(lock bool) error {
signal = syscall.SIGKILL
}
// make sure the process is not dead
if s.command.ProcessState != nil && s.command.ProcessState.Exited() {
return nil
}
if err := syscall.Kill(-s.command.Process.Pid, signal); err != nil {
log.Printf("error killing previous process: %v", err)
return err