Documentation
¶
Overview ¶
Package procgroup puts a child process in its own process group so a context cancellation kills the WHOLE group — not just the direct child. A shell command can spawn grandchildren (e.g. `sh -c "sleep 5"` or a backgrounded `make` with compiler children); killing only the shell orphans them, and a grandchild holding the stdout/stderr pipes makes (*exec.Cmd).Wait block until it exits — defeating the caller's timeout/cancel. Configure(cmd) installs Setpgid plus a Cancel that signals the negative PID, delivering SIGKILL to every process in the group so the pipes close promptly and Run honours its deadline. Shared by the hook runner (hookexec) and the Shell command runner (osfs).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Configure ¶
Configure puts cmd in its own process group and, on context cancellation, kills the entire group rather than just the leader. Signalling the negative PID delivers SIGKILL to every process in the group, so orphaned grandchildren die with their parent and any pipes they inherited close promptly.
func GroupAlive ¶ added in v0.0.26
GroupAlive reports whether the managed process group remains alive. It does not inspect escaped descendants, which are outside the managed contract.
func Kill ¶ added in v0.0.26
Kill terminates the managed process group. A vanished group is already done.
Types ¶
This section is empty.