Skip to main content

Module process_group

Module process_group 

Source
Expand description

Process-group helpers shared by process execution backends.

On non-Unix platforms these helpers are no-ops.

Functions§

detach_from_tty
Detach from the controlling TTY by starting a new session.
kill_by_pid
Resolve a process group by PID and send SIGKILL.
kill_process_group
Send SIGKILL to the process group pgid directly — no lookup through the leader pid. This is the form that still reaches a group’s surviving members after the leader exited and was reaped: kill_by_pid’s getpgid resolution returns ESRCH then and silently spares them. A fully-gone group reads as success. Groups 0 and 1 are rejected rather than signalled: to killpg they mean the caller’s own group and init’s.
process_group_is_alive
Whether any process remains in the group led by pgid, including members that outlived the leader. Signal 0 runs killpg’s existence and permission checks without delivering anything, so EPERM (the group is another user’s) counts as alive. Groups 0 and 1 are rejected rather than probed: to killpg they mean the caller’s own group and init’s.
set_parent_death_signal
Ensure the child receives SIGTERM when the original parent dies.
set_process_group
Put the calling process into its own process group.