run

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Label added in v0.3.2

func Label(ctx context.Context) string

Label returns the label attached to ctx by WithLabel, or "" if there is none. Components can use it to tag their own log messages the same way their command output is tagged.

func LogCommand

func LogCommand(cmd string, args ...string) error

LogCommand runs the specified command but records standard output with log.Info and standard error with log.Warning.

func LogCommandContext added in v0.3.2

func LogCommandContext(ctx context.Context, cmd string, args ...string) error

LogCommandContext is LogCommand with any label attached to ctx applied to the logged output.

func LogCommandWithInput

func LogCommandWithInput(in []byte, cmd string, args ...string) error

LogCommandWithInput runs the specified command but records standard output with log.Info and standard error with log.Warning. in is sent to the standard input of the command.

func OutCommand

func OutCommand(cmd string, args ...string) ([]byte, error)

OutCommand runs the specified command and returns any standard output as well as any errors.

func OutLogCommand

func OutLogCommand(cmd string, args ...string) ([]byte, error)

OutLogCommand runs the specified command but records standard output with log.Info and standard error with log.Warning. Standard output and standard error are also returned.

func WithLabel added in v0.3.2

func WithLabel(ctx context.Context, label string) context.Context

WithLabel returns a copy of ctx that tags the output of commands run with it as coming from label. Callers that run commands concurrently should set a label; without one the interleaved output of several commands is indistinguishable, since every line is attributed only to the binary that produced it.

The label affects logging only. It does not tie the command's lifetime to ctx: commands are not canceled when ctx ends.

Types

This section is empty.

Jump to

Keyboard shortcuts

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