procgroup

package
v0.0.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

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 Bash command runner (osfs).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure(c *exec.Cmd)

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 Supported added in v0.0.22

func Supported() bool

Supported reports whether this platform can contain a whole command tree.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL