Help us shape the future of Go! Take the 2026 Go Developer Survey

proctree

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package proctree runs a command as the root of its own process tree and kills the whole tree: hooks and the shell tools share it, so a timeout takes down whatever the command started as well.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Kill

func Kill(cmd *exec.Cmd) error

Kill sends SIGKILL to cmd's process group. A command that never started, or whose group is already gone, is not an error.

Called after Wait, the group leader has been reaped; the kernel cannot recycle a pgid while any member of the group still exists, so the only residual risk is an unrelated new group leader that reused this exact pid after the group emptied.

func Release

func Release(cmd *exec.Cmd)

Release lets go of what Start kept for Kill. A process group needs nothing, so on unix it does nothing; call it anyway, after Wait and any Kill, for Windows.

func Start

func Start(cmd *exec.Cmd) error

Start starts cmd in a new process group and makes cancelling its context kill the whole group. Use it instead of cmd.Start; it keeps any other SysProcAttr fields already set. cmd must come from exec.CommandContext.

func StartSession

func StartSession(cmd *exec.Cmd) error

StartSession is Start in a new session instead of only a new process group: the command has no controlling terminal, so it cannot open /dev/tty and type into celeste's prompts (TIOCSTI). The session leader leads a process group of the same id, so Kill and cancelling the context still end the whole group. The sandboxed shell runs use it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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