execution

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_SSH_PORT = 22
)

Variables

This section is empty.

Functions

func ExpandTilde added in v0.1.4

func ExpandTilde(path string) string

ExpandTilde expands ~ to the user's home directory using $HOME

Types

type CommandRequest

type CommandRequest struct {
	Command        string    // shell or binary invocation to run
	Stdout         io.Writer // optional live stdout
	Stderr         io.Writer // optional live stderr
	Stdin          io.Reader // optional stdin source
	UsePTY         bool      // request a PTY/TTY when supported
	DisableCapture bool      // when true, do not retain combined output
}

CommandRequest defines how a command should be executed by an ExecutionClient.

type CommandResult

type CommandResult struct {
	Output   string // combined stdout+stderr unless capture disabled
	ExitCode int
}

CommandResult describes the outcome of a command invocation.

type ExecutionClient

type ExecutionClient interface {
	RunCommand(ctx context.Context, req CommandRequest) (CommandResult, error)
	CheckPort(ctx context.Context, port string, timeout time.Duration) (bool, error)
	Scp(ctx context.Context, remotePath, localPath string) error
	Upload(ctx context.Context, localPath, remotePath string) error
	Close() error
}

ExecutionClient defines the interface for executing commands on hosts.

func NewLocalClient

func NewLocalClient() ExecutionClient

NewLocalClient creates a new local execution client

func NewSSHClient

func NewSSHClient(host config.Host) (ExecutionClient, error)

Jump to

Keyboard shortcuts

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