cmd
cmd copied to clipboard
make terminating process group optional
I've got a use case where I don't necessarily want to terminate an entire process group (i.e. having children outlive the parent is desired).
If you're open to such a patch, I can look into implementing it. The default behavior should be the current behavior: SIGTERM the process group.
Yeah if there's a clean way to make this optional, I'm open to a PR. We'll also have to see if it doesn't mess up Wait because currently the code says,
// Signal the process group (-pid), not just the process, so that the process
// and all its children are signaled. Else, child procs can keep running and
// keep the stdout/stderr fd open and cause cmd.Wait to hang.
return terminateProcess(c.status.PID)