I have a problem trying to restore a process in go. My application starts a bunch of processes, and when it crashes, the processes there are in the public domain, and when I restart my application, I want to restore my processes. In windows everything works as expected, I can wait() in the process of kill() , etc., but in linux it just goes through my wait() without any errors. Here is the code
func (proc *process) Recover() { pr, err := os.FindProcess(proc.Cmd.Process.Pid) if err != nil { return } log.Info("Recovering " + proc.Name + proc.Service.Version) Processes.Lock() Processes.Map[proc.Name] = proc Processes.Unlock() proc.Cmd.Process = pr if proc.Service.Reload > 0 { proc.End = make(chan bool) go proc.KillRoutine() } proc.Cmd.Wait() if proc.Status != "killed" { proc.Status = "finished" } proc.Time = time.Now() channelProcess <- proc
process is my own structure for processing processes. The important part is cmd, which from the "os/exec" package I also tried to call pr.wait() directly with the same problem
source share