Hi,
I’m running go version go1.9.3 darwin/amd64.
The code :
cmd := exec.Command(command, options.Args...) // bash process - ruby running forever
cmd.Start()
go cmd.Wait() // I can see my process up and get to it
time.Sleep(20 * time.Second)
syscall.Kill(cmd.Process.Pid, syscall.SIGINT) // ruby process get the signal and do nothing with it
time.Sleep(5 * time.Second)
cmd.Process.Signal(os.Interrupt) // ruby process get the signal and do nothing with it
time.Sleep(5 * time.Second)
syscall.Kill(p.cmd.Process.Pid, syscall.SIGTERM) // ruby process get the signal and do nothing with it
time.Sleep(5 * time.Second)
syscall.Kill(p.cmd.Process.Pid, syscall.SIGKILL) //This will kill the process
//cmd.Process.Kill() //This will kill the process
//cmd.Process.Signal(os.Kill) //This will kill the process
The problem is that the only way to stop the process is killing it immediately (equal to kill -9 )
Manually it is possible to interrupt or terminate the process and not to kill it.
I would like to understand how to interrupt the process in a way it will work