> Is there any way to create a child process that is detached from the 
original cgroup using exec.Command?
> I don't want my child process to be killed when the parent process dies.

This might be an issue with process groups, not cgroups, in which case I 
think Setsid is what you want, something like (untested):

        p.theCommand.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
        err := p.theCommand.Start()

I had a related problem: I wanted to make sure that when a timeout occurs, 
I forcibly kill the child process and all its descendants. Solution was to 
use Setsid, and then send the signal to the newly-formed process group:
https://groups.google.com/g/golang-nuts/c/V1VccYYCp9o/m/rZRfhP_bCAAJ

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/16e02502-c948-4261-aabb-845bc234430fn%40googlegroups.com.

Reply via email to