exec

package
v0.0.0-...-115eb97 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package exec provides command execution utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdResult

type CmdResult struct {
	// Stdout contains the standard output of the command.
	Stdout string
	// Stderr contains the standard error output of the command.
	Stderr string
	// ExitCode is the exit code of the command.
	ExitCode int
	// DurationMs is the execution time in milliseconds.
	DurationMs int64
}

CmdResult contains the full result of a command execution with separate stdout and stderr streams.

type Exec

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

Exec disk implementation.

func New

func New(
	logger *slog.Logger,
) *Exec

New factory to create a new Exec instance.

func (*Exec) RunCmd

func (e *Exec) RunCmd(
	name string,
	args []string,
) (string, error)

RunCmd executes the provided command with arguments, using the current working directory.

func (*Exec) RunCmdFull

func (e *Exec) RunCmdFull(
	name string,
	args []string,
	cwd string,
	timeout int,
) (*CmdResult, error)

RunCmdFull executes the provided command with separate stdout and stderr capture, an optional working directory, and a timeout in seconds. A timeout of 0 defaults to 30 seconds.

func (*Exec) RunCmdImpl

func (e *Exec) RunCmdImpl(
	name string,
	args []string,
	cwd string,
) (string, error)

RunCmdImpl executes the provided command with the specified arguments and an optional working directory. It captures and logs the combined output (stdout and stderr) of the command.

func (*Exec) RunCmdInDir

func (e *Exec) RunCmdInDir(
	name string,
	args []string,
	cwd string,
) (string, error)

RunCmdInDir executes the provided command with arguments, using the current provided directory.

type Manager

type Manager interface {
	// RunCmd executes the provided command with arguments, using the current
	// working directory.
	RunCmd(
		name string,
		args []string,
	) (string, error)

	// RunCmdFull executes a command with separate stdout/stderr capture,
	// an optional working directory, and a timeout in seconds.
	RunCmdFull(
		name string,
		args []string,
		cwd string,
		timeout int,
	) (*CmdResult, error)
}

Manager manager responsible for exec operations.

Directories

Path Synopsis
Package mocks provides mock implementations for testing.
Package mocks provides mock implementations for testing.

Jump to

Keyboard shortcuts

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