Hi all,
I'm trying to use the technique here
.. to ensure all children/grandchildren of my exec of /bin/bash die along with it, but I am getting the above 'operation not permitted' error when trying to Start(). It works fine without Setpgid set, but when my /bin/bash dies, any background children spawned from it are left running, adopted by init (pid 1).
Any idea why setting syscall.SysProcAttr{Setpgid: true} might not work with certain other attributes set? My program is a daemon running as root, and sets Uid/Gid to another non-root user; it also uses
github.com/kr/pty, the Start() method of which also sets some other attributes, .Setctty and .Setsid. I tried going through the golang stdlib startProcess() code and related bits, but don't fully understand how all of these optional flags interact.
Thanks,
-Russ