Done() function in exec.go - what is the requirement for this?

func (p *Process) done() bool {
return atomic.LoadUint32(&p.isdone) > 0
}

// Process stores the information about a process created by StartProcess.
type Process struct {
Pid int
handle uintptr // handle is accessed atomically on Windows
isdone uint32 // process has been successfully waited on, non zero if true
sigMu sync.RWMutex // avoid race between wait and signal
}

It is called from system specific implementations to check if the process is done.

Yup. I did see come across a scenario where the when signal is sent to kill, the exec_unix.go:
without sending the signal to the process.

It makes me think if this check is required here. Thats something i want to clarify.
In my case i have parent process receiving SIGINT and I am trying to end this child process by sending signal. I tried to put a sleep inside the check to see if the process exists or not. And it ends. Because the parent is killed. Or maybe where this check needs to be done matters - this is my question.

func (p *Process) signal(sig Signal) error {
if p.Pid == -1 {
return errors.New(“os: process already released”)
}
if p.Pid == 0 {
return errors.New(“os: process not initialized”)
}
p.sigMu.RLock()
defer p.sigMu.RUnlock()
if p.done() { // ===================>> HERE!
return errFinished
}
s, ok := sig.(syscall.Signal)
if !ok {
return errors.New(“os: unsupported signal type”)
}
if e := syscall.Kill(p.Pid, s); e != nil {
if e == syscall.ESRCH {
return errFinished
}
return e
}
return nil
}