procgroup

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package procgroup runs child processes that may fork, such as an agent's CLI, so that stopping the child stops what it started.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Adopt added in v0.3.0

func Adopt(pgid int) (release func())

Adopt lists the group pgid a Prepare'd command leads, so KillAll and the next process's Track stop it; release, once the command exited, kills what is left of the group and unlists it.

func KillAll

func KillAll()

KillAll sends SIGKILL to every group a Run is waiting on, for a process about to exit. A group that starts after stays listed for Track.

func Prepare added in v0.3.0

func Prepare(cmd *exec.Cmd)

Prepare sets cmd to start as the leader of its own process group, for a caller that starts it itself; once started, Adopt lists its group.

func Run

func Run(cmd *exec.Cmd) error

Run runs cmd, made by exec.Command or exec.CommandContext, as the leader of its own process group. Cancelling cmd's context sends the group SIGTERM. Once the child exits, whatever is left of its group gets SIGTERM and, after the grace, SIGKILL.

func Track

func Track(path string) error

Track kills the groups a previous process listed at path, which a crash left running, and from then on keeps path listing the live groups. The caller holds the lock that makes it the only such process.

Types

This section is empty.

Jump to

Keyboard shortcuts

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