executor

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdRunner

type CmdRunner interface {
	Run() error
	Start() error
	Wait() error
	Output() ([]byte, error)
	CombinedOutput() ([]byte, error)
	StdinPipe() (io.WriteCloser, error)
	StdoutPipe() (io.ReadCloser, error)
	StderrPipe() (io.ReadCloser, error)
	SetEnv(env []string)
	SetStdin(stdin io.Reader)
}

CmdRunner is an interface that exec.Cmd-like commands must implement

type Executor

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

Executor wraps subprocess execution with automatic output logging via slog

func New

func New(logger *slog.Logger) *Executor

New creates a new Executor that logs subprocess output via slog The logger should be configured to handle subprocess output appropriately

func (*Executor) Close

func (e *Executor) Close() error

Close is a no-op for compatibility

func (*Executor) Command

func (e *Executor) Command(name string, args ...string) *exec.Cmd

Command creates a new command for use with Output() Only stderr is logged/displayed, stdout is captured by Output()

func (*Executor) CommandWithOutput

func (e *Executor) CommandWithOutput(name string, args ...string) CmdRunner

CommandWithOutput creates a command that displays and logs subprocess output Use this for commands that call Run() (not Output()) Output is displayed in real-time with indentation, then logged as a single entry when complete

Jump to

Keyboard shortcuts

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