procgroup

package
v0.720.2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package procgroup gives the spawn sites that wrap a command with the host sandbox (internal/sandbox) a small, OS-specific way to stop the whole process tree they start, not just the direct child pid.

A sandboxed long-running child (an ACP terminal, an MCP stdio server, a mesnada sub-agent CLI) may actually be a launcher in front of the real program: bubblewrap on Linux, or a shell script a template/ACP agent config points at. Signalling only the direct pid can leave the real work running, or leave grandchildren behind once the launcher exits. Putting the child in its own process group (Ensure, called before Start) and signalling that group (Kill) reaches the launcher and everything it spawned in one call, the same pattern internal/llm/tools/shell already uses for the persistent shell.

Ensure is safe to call unconditionally, whether or not the command ends up wrapped by the sandbox: grouping is a general cleanup improvement, not a sandbox-only concern (a plain shell script can spawn children too).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ensure

func Ensure(cmd *exec.Cmd) bool

Ensure makes cmd the leader of its own process group before Start, unless it is already going to be one (Setsid was requested by the caller or a sandbox Wrapper — setpgid fails for a session leader). It always returns true on this platform: after Start, Kill(cmd.Process.Pid, ...) reaches the whole group.

func Kill

func Kill(pid int, sig syscall.Signal) bool

Kill signals the process group led by pid. It reports whether the group could be signalled at all (a false return means the caller should fall back to signalling the process alone).

Types

This section is empty.

Jump to

Keyboard shortcuts

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