execbuf

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStdoutSet = errors.New("stdout already set")
	ErrStderrSet = errors.New("stderr already set")
	ErrStarted   = errors.New("exec buffer after process started")
)

Functions

This section is empty.

Types

type Buffer

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

Buffer is an io.Writer that buffers exec.Cmd output. Writes contain timestamp and source metadata so the output can be replayed.

func RunBuffered

func RunBuffered(cmd *exec.Cmd, stdout, stderr io.Writer) (*Buffer, error)

RunBuffered runs the provided exec.Cmd with buffered stdout/stderr streams.

func (*Buffer) Bytes

func (e *Buffer) Bytes(source io.Writer) []byte

Bytes returns the bytes for a source, or all sources if nil.

func (*Buffer) Close

func (e *Buffer) Close()

Close waits for all in-flight writes to finish, then sorts them by timestamp.

func (*Buffer) Len

func (e *Buffer) Len(source io.Writer) int64

Len returns the number of bytes written for a source, or all sources if nil.

func (*Buffer) Print

func (e *Buffer) Print(source io.Writer) error

Print prints output for a source, or all sources if nil.

func (*Buffer) Writer

func (e *Buffer) Writer(f io.Writer) *BufferWriter

Writer creates an BufferWriter which writes to the provided stream.

type BufferWriter

type BufferWriter struct {
	*Buffer
	// contains filtered or unexported fields
}

BufferWriter handles writes to a given source.

func (*BufferWriter) Write

func (e *BufferWriter) Write(p []byte) (int, error)

Write writes bytes for a source to the parent Buffer.

Jump to

Keyboard shortcuts

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