subcommand

package
v3.1.12+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package subcommand provides a way to execute subcommands while passing the arguments and output via filesystem to avoid data size limitations. It also shares the configuration and other params needed to run cmdintegration and handles panics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Kill

func Kill(opts KillCmdOpts, process *os.Process) error

func KillCommand

func KillCommand(opts KillCmdOpts, cmdname string) error

KillCommand stops a running process

Types

type Cancelled

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

Cancelled implementation of error.

func (*Cancelled) Error

func (e *Cancelled) Error() string

type Command

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

Command is struct for executing cmdintegration based commands

func New

func New(opts Opts) (*Command, error)

New creates a command

func (*Command) Run

func (c *Command) Run(ctx context.Context, cmdname string, messageID string, res interface{}, args ...string) error

Run executes the command

func (*Command) RunKeepLogFile

func (c *Command) RunKeepLogFile(ctx context.Context, cmdname string, messageID string, res interface{}, args ...string) (logFileName string, rerrv error)

RunKeepLogFile executes the command creating a file for stderr. It returns the path to that file.

type KillCmdOpts

type KillCmdOpts struct {
	PrintLog func(msg string, args ...interface{})
}

type Opts

type Opts struct {
	Logger            hclog.Logger
	Tmpdir            string
	IntegrationConfig cmdintegration.AgentConfig
	AgentConfig       agentconf.Config
	Integrations      []inconfig.IntegrationAgent
	DeviceInfo        deviceinfo.CommonInfo
}

Opts are options needed to create Command

Jump to

Keyboard shortcuts

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