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

exec

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const Name = "system/exec"

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Input  string `json:"input,omitempty"`
	Output string `json:"output,omitempty"`
	Stderr string `json:"stderr,omitempty"`
	Status int    `json:"status,omitempty"`
}

Command represents the result of executing a single command

type Input

type Input struct {
	Host         *sys.Host         `json:"host,omitempty" internal:"true" description:"Target host. Use bash://localhost/ (default) or ssh://user@host:22."`
	Workdir      string            `json:"workdir,omitempty" description:"Working directory for file operations. Example: /repo/path."`
	Env          map[string]string `json:"env,omitempty" description:"Environment variables (k=v) set before running. Example: {'GOFLAGS':'-mod=mod'}."`
	Commands     []string          `json:"commands,omitempty" description:"Commands to run in order (no pipes). Example: ['rg --files', 'sed -n 1,20p file.go']."`
	TimeoutMs    int               `json:"timeoutMs,omitempty" yaml:"timeoutMs,omitempty" description:"Per-command timeout in ms (default 180000)."`
	AbortOnError *bool             `json:"abortOnError,omitempty" description:"Stop on first non-zero status (default true)."`
}

Input represents system executor configuration

func (*Input) HasFSCommand

func (i *Input) HasFSCommand() string

func (*Input) Init

func (i *Input) Init()

type Output

type Output struct {
	Commands []*Command `json:"commands,omitempty"`
	Stdout   string     `json:"stdout,omitempty"`
	Stderr   string     `json:"stderr,omitempty"`
	Status   int        `json:"status,omitempty"`
}

Output represents the results of executing commands

type Service

type Service struct{}

Service executes terminal commands

func New

func New() *Service

New creates a new Service instance

func (*Service) Execute

func (s *Service) Execute(ctx context.Context, input *Input, output *Output) error

Execute executes terminal commands on the target system

func (*Service) Method

func (s *Service) Method(name string) (svc.Executable, error)

Method resolves an executable by name.

func (*Service) Methods

func (s *Service) Methods() svc.Signatures

Methods returns method signatures for this service.

func (*Service) Name

func (s *Service) Name() string

Name returns the service name.

Jump to

Keyboard shortcuts

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