procSysProcAttr returns the SysProcAttr to use when spawning processes. On Unix, Setpgid creates a new process group so that signals can be delivered to the entire group (the shell and all its children).
()
| 12 | // that signals can be delivered to the entire group (the shell |
| 13 | // and all its children). |
| 14 | func procSysProcAttr() *syscall.SysProcAttr { |
| 15 | return &syscall.SysProcAttr{ |
| 16 | Setpgid: true, |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | // signalProcess sends a signal to the process group rooted at p. |
| 21 | // Using the negative PID sends the signal to every process in the |