On Tue, Aug 1, 2017 at 5:03 PM, yihao yang <yangyihao1...@gmail.com> wrote:
>         err := syscall.Kill(int(dmInfo.Pid), syscall.Signal(0))
>         if err == syscall.ESRCH {
>           Warning("Daemon stopped for unknown reason. BinaryId:", binaryId)
>                   } else {
>           if err != nil {
>             Info("Daemon got error when signal-ed by 0. err:(", err.Error(),
>                 ") BinaryId:", binaryId)
>           }
>                  }
>
> Hi,
>
> I have a code snippet background. It will check if a given process is
> exited. But based on my test, the first line syscall.Kill will always return
> nil even if the child process is already done (e.g. In the test, I ran an
> 'echo' command first and sleep for a long time before calling the code
> snippet above).
> I use cmd.Start to start my child process.
> Anyone knows why?

That's how Unix works.  In between the time that a process exits and
the time that its parent calls wait, the process is a zombie (assuming
the parent process has not ignored SIGCHLD signals).   You can send a
signal to a zombie process, although nothing changes for the process
since it is no longer running.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to