proc

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package proc handles process-group lifecycle for the monitored Codex child.

Codex spawns its own shell commands (e.g. /bin/zsh -lc 'go test'), so killing only the codex PID would orphan those children. We therefore launch codex in its own process group and signal the whole group.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alive

func Alive(pid int) bool

Alive reports whether a process is still running (signal 0 probe).

func KillGroupNow

func KillGroupNow(pid int)

KillGroupNow sends an immediate SIGKILL to the whole process group led by pid. Use for timeout cancellation where a graceful SIGTERM grace is not worth waiting for.

func SetChildGroup

func SetChildGroup(cmd *exec.Cmd)

SetChildGroup configures cmd so the child becomes the leader of a fresh process group, letting us signal it and all of its descendants together.

It also pins Stdin: if the caller leaves cmd.Stdin nil, exec connects the child to /dev/null, which is exactly what we want — a piped, never-closing stdin is the classic cause of `codex exec` hanging on "Reading additional input from stdin...".

func SetDetached

func SetDetached(cmd *exec.Cmd)

SetDetached configures cmd to survive its launcher: a new session means the process is reparented to init and is unaffected when the spawning shell (and the Claude Bash tool that ran it) exits.

func TerminateGroup

func TerminateGroup(pid int, grace time.Duration)

TerminateGroup asks the process group led by pid to stop: SIGTERM first, then SIGKILL after grace if anything is still alive. The negative pid targets the whole group. It is safe to call on a dead process.

Types

This section is empty.

Jump to

Keyboard shortcuts

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