Help us shape the future of Go! Take the 2026 Go Developer Survey

exec

package
v0.487.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capture

func Capture(ctx context.Context, dir, exe string, args ...string) ([]byte, error)

func LookPath

func LookPath(exe string) (string, error)

Types

type CircularBuffer

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

func NewCircularBuffer

func NewCircularBuffer(capacity int) *CircularBuffer

func (*CircularBuffer) Bytes

func (cb *CircularBuffer) Bytes() []byte

func (*CircularBuffer) Write

func (cb *CircularBuffer) Write(p string) error

Write accepts a string and stores it in the buffer. It expects entire lines and stores each line as a separate entry in the ring buffer.

func (*CircularBuffer) WriterAt

func (cb *CircularBuffer) WriterAt(ctx context.Context, level log.Level) *io.PipeWriter

type Cmd

type Cmd struct {
	*exec.Cmd
	// contains filtered or unexported fields
}

func Command

func Command(ctx context.Context, level log.Level, dir, exe string, args ...string) *Cmd

func CommandWithEnv

func CommandWithEnv(ctx context.Context, level log.Level, dir string, env []string, exe string, args ...string) *Cmd

func (*Cmd) Capture added in v0.471.0

func (c *Cmd) Capture(ctx context.Context) ([]byte, error)

Capture runs the command and captures the output. If the command fails, the stderr is returned as the error message.

func (*Cmd) Kill

func (c *Cmd) Kill(signal syscall.Signal) error

Kill sends a signal to the process group of the command.

func (*Cmd) RunBuffered

func (c *Cmd) RunBuffered(ctx context.Context) error

RunBuffered runs the command and captures the output. If the command fails, the output is logged.

func (*Cmd) RunStderrError

func (c *Cmd) RunStderrError(ctx context.Context) error

RunStderrError runs the command and captures stderr. If the command fails, the stderr is returned as the error message.

Jump to

Keyboard shortcuts

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