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

exec

package
v0.1.58 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const Name = "system/exec"

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelInput added in v0.1.7

type CancelInput struct {
	SessionID string `json:"sessionId,omitempty"`
	ProcessID string `json:"processId,omitempty"`
}

type CancelOutput added in v0.1.7

type CancelOutput struct {
	Status string `json:"status,omitempty"`
}

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 {
	SessionID    string             `json:"sessionId,omitempty" description:"Optional shell session id to reuse across multiple execute calls."`
	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)."`
	Stream       string             `` /* 132-byte string literal not displayed */
	ByteRange    *textutil.IntRange `json:"byteRange,omitempty" description:"Optional byte range [from,to) over the selected stream content."`
}

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 {
	SessionID    string                  `json:"sessionId,omitempty"`
	Commands     []*Command              `json:"commands,omitempty"`
	Stream       string                  `json:"stream,omitempty"`
	Stdout       string                  `json:"stdout,omitempty" description:"Full buffered stdout accumulated so far. Not truncated."`
	Stderr       string                  `json:"stderr,omitempty" description:"Full buffered stderr accumulated so far. Not truncated."`
	Content      string                  `json:"content,omitempty" description:"Selected stream content slice when stream/byteRange paging is used."`
	Offset       int                     `json:"offset,omitempty"`
	Limit        int                     `json:"limit,omitempty"`
	Size         int                     `json:"size,omitempty"`
	Continuation *extension.Continuation `json:"continuation,omitempty" description:"Native byte-range continuation for the selected stream content."`
	Status       int                     `json:"status,omitempty"`
}

Output represents the results of executing commands

type Service

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

Service executes terminal commands

func New

func New() *Service

New creates a new Service instance

func (*Service) AsyncConfig added in v0.1.7

func (s *Service) AsyncConfig(toolName string) *asynccfg.Config

func (*Service) AsyncConfigs added in v0.1.7

func (s *Service) AsyncConfigs() []*asynccfg.Config

func (*Service) CacheableMethods added in v0.1.7

func (s *Service) CacheableMethods() map[string]bool

CacheableMethods declares which methods produce cacheable outputs.

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.

type StartInput added in v0.1.7

type StartInput struct {
	SessionID    string            `json:"sessionId,omitempty" description:"Optional async session id. When empty, the runtime generates one."`
	Host         *sys.Host         `json:"host,omitempty" internal:"true" description:"Target host. Detached mode currently supports localhost only."`
	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."`
	Commands     []string          `json:"commands,omitempty" description:"Commands to run in order (no pipes)."`
	TimeoutMs    int               `` /* 142-byte string literal not displayed */
	AbortOnError *bool             `json:"abortOnError,omitempty" description:"Stop on first non-zero status (default true)."`
}

type StartOutput added in v0.1.7

type StartOutput struct {
	SessionID string `json:"sessionId,omitempty"`
	ProcessID string `json:"processId,omitempty"`
	Status    string `json:"status,omitempty"`
}

type StatusInput added in v0.1.7

type StatusInput struct {
	SessionID string             `json:"sessionId,omitempty"`
	ProcessID string             `json:"processId,omitempty"`
	Stream    string             `json:"stream,omitempty" description:"Optional stream selector for ranged reads: stdout, stderr, or combined."`
	ByteRange *textutil.IntRange `json:"byteRange,omitempty" description:"Optional byte range [from,to) over the selected stream content."`
}

type StatusOutput added in v0.1.7

type StatusOutput struct {
	SessionID    string                  `json:"sessionId,omitempty"`
	ProcessID    string                  `json:"processId,omitempty"`
	Stream       string                  `json:"stream,omitempty"`
	Status       string                  `json:"status,omitempty"`
	ExitCode     *int                    `json:"exitCode,omitempty"`
	Stdout       string                  `json:"stdout,omitempty" description:"Full buffered stdout accumulated so far. Not truncated."`
	Stderr       string                  `json:"stderr,omitempty" description:"Full buffered stderr accumulated so far. Not truncated."`
	Content      string                  `json:"content,omitempty" description:"Selected stream content slice when stream/byteRange paging is used."`
	Offset       int                     `json:"offset,omitempty"`
	Limit        int                     `json:"limit,omitempty"`
	Size         int                     `json:"size,omitempty"`
	Continuation *extension.Continuation `json:"continuation,omitempty" description:"Native byte-range continuation for the selected stream content."`
}

Jump to

Keyboard shortcuts

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