proc

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package proc runs child commands so that cancelling them stops everything they started.

Index

Constants

View Source
const CanTellAlive = true

CanTellAlive reports whether Alive can see that a process has exited.

Variables

This section is empty.

Functions

func Alive

func Alive(pid int) bool

Alive reports whether a process with this ID exists.

func Group

func Group(cmd *exec.Cmd)

Group makes cancellation of cmd stop the processes it started too (a shell pipeline, a terraform wrapper and its terraform), and bounds the wait for children that still hold stdout or stderr open after cmd has exited or been cancelled.

func Stream added in v0.1.6

func Stream(ctx context.Context, cmd *exec.Cmd, consume func(io.Reader) error) error

Stream runs cmd and consumes stdout without bounding the reading time. Stderr writers other than *os.File receive only the last 1 MiB. Group must be called before Stream. Stdin must be nil or an *os.File.

Types

type StderrBuffer added in v0.1.6

type StderrBuffer struct {
	// contains filtered or unexported fields
}

StderrBuffer retains the last 1 MiB, discarding earlier output.

func (*StderrBuffer) Bytes added in v0.1.6

func (b *StderrBuffer) Bytes() []byte

func (*StderrBuffer) Write added in v0.1.6

func (b *StderrBuffer) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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