exec

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2025 License: Apache-2.0 Imports: 15 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"`  // The command that was executed
	Output string `json:"output,omitempty"` // Standard output from the command
	Stderr string `json:"stderr,omitempty"` // Standard error from the command
	Status int    `json:"status,omitempty"` // Exit code of the command
}

Command represents the result of executing a single command

type Input

type Input struct {
	Host      *system.Host `json:"host,omitempty" description:"host to execute command on"  internal:"true" ` //host to execute command on
	Directory string       ``                                                                                 //directory where command should run
	/* 126-byte string literal not displayed */
	Env          map[string]string `json:"env,omitempty" description:"environment variables to be set before command runs" ` //environment variables to be set before command runs
	Commands     []string          `json:"commands,omitempty" description:"commands to execute on the target system"`        //commands to run
	TimeoutMs    int               `json:"timeoutMs,omitempty" yaml:"timeoutMs,omitempty" description:"max wiat time before timing out command"`
	AbortOnError *bool             `json:"abortOnError,omitempty" description:"check after command execution if status is <> 0, then throws error" ` //whether to abort on error
}

Input represents system executor configuration

func (*Input) Init

func (i *Input) Init()

type Output

type Output struct {
	Commands []*Command `json:"commands,omitempty"` // Results of individual commands
	Stdout   string     `json:"stdout,omitempty"`   // Combined standard output from all commands
	Stderr   string     `json:"stderr,omitempty"`   // Combined standard error from all commands
	Status   int        `json:"status,omitempty"`   // Exit code of the last command executed
}

Output represents the results of executing commands

type Service

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

Service struct for executing terminal commands

func New

func New() *Service

New creates a new Service instance

func (*Service) Close

func (s *Service) Close(ctx context.Context) error

Close releases all sessions held by this service

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) (types.Executable, error)

Method returns method by Name

func (*Service) Methods

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

func (*Service) Name

func (s *Service) Name() string

type Session

type Session struct {
	ID               string            // Unique session identifier
	CurrentDirectory string            // Current working directory
	EnvVariables     map[string]string // Environment variables set in this session
}

Session represents a terminal session

func NewSession

func NewSession(id string) *Session

NewSession creates a new session

Jump to

Keyboard shortcuts

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