exec

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	Name    string
	Args    []string
	Timeout time.Duration
	Dir     string
	Env     []string
	Stdout  io.Writer
	Stderr  io.Writer
	Stdin   io.Reader
	// contains filtered or unexported fields
}

Cmd represents a Cmd to be executed.

func Command

func Command(name string, args ...string) *Cmd

Command creates a new command instance.

func CommandContext

func CommandContext(ctx context.Context, name string, args ...string) *Cmd

CommandContext creates a new command instance with context.

func NewCommand

func NewCommand(name string, args ...string) *Cmd

NewCommand creates a new command instance.

func (*Cmd) CombinedOutput

func (c *Cmd) CombinedOutput() ([]byte, error)

CombinedOutput runs the command and returns its combined standard output and standard error.

func (*Cmd) Run

func (c *Cmd) Run() error

Run executes the command and waits for it to finish.

func (*Cmd) WithDir

func (c *Cmd) WithDir(dir string) *Cmd

WithDir sets the working directory for the command.

func (*Cmd) WithEnv

func (c *Cmd) WithEnv(env []string) *Cmd

WithEnv sets the environment variables for the command.

func (*Cmd) WithStderr

func (c *Cmd) WithStderr(stderr io.Writer) *Cmd

WithStderr sets the stderr writer for the command.

func (*Cmd) WithStdin

func (c *Cmd) WithStdin(stdin io.Reader) *Cmd

WithStdin sets the stdin reader for the command.

func (*Cmd) WithStdout

func (c *Cmd) WithStdout(stdout io.Writer) *Cmd

WithStdout sets the stdout writer for the command.

func (*Cmd) WithTimeout

func (c *Cmd) WithTimeout(timeout time.Duration) *Cmd

WithTimeout set the timeout for the command.

Jump to

Keyboard shortcuts

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