command

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EnvKey = envKeyType{}

EnvKey is a context.Context.WithValue key that can be used to override the environment of commands that are executed by this package. The value must have type []string where each entry has the form "name=value".

Functions

func DecodeJsonStream

func DecodeJsonStream[T any](ctx context.Context, wd string, args ...string) (iter.Seq[T], func() error)

DecodeJsonStream calls Pipe and processes the output as a stream of JSON objects. The returned done callback must be called when done processing the JSON stream. Beware that if the done callback is called before the command is done outputting JSON values then the command will receive a SIGPIPE signal.

func New

func New(ctx context.Context, wd string, args ...string) *exec.Cmd

New constructs a new exec.Cmd with the given arguments, leaving its stdout and stderr connected to stdout and stderr.

func Pipe

func Pipe(ctx context.Context, wd string, args ...string) (*exec.Cmd, io.ReadCloser, error)

Pipe is like New except it connects the command's stdout to a pipe and the reading side is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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