proctree

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 7 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 proctree starts native CLI processes and stops them with everything they started.

A process group is not enough: the CLIs run tools in groups of their own (Claude Code starts every shell in a new process group, verified with a background task), so killing the CLI's group leaves those tools running after the run. KillTree therefore also kills the group of every descendant found in the process table while the CLI still runs. A process that has already detached (its parent exited, e.g. `nohup cmd &` from a shell that ended) is outside the tree; only the container boundary contains it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(ctx context.Context, binary string, args ...string) *exec.Cmd

Command builds a process in its own process group; cancelling ctx kills its tree.

func KillTree

func KillTree(pid int) error

KillTree sends SIGKILL to the process group of pid and to the group of each descendant.

func Reap

func Reap(pid int)

Reap kills what is left in the group of an exited process (its own children that stayed in it).

Types

This section is empty.

Jump to

Keyboard shortcuts

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