external

package
v0.0.0-...-2bc12df Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	Start() error
	Run() error
	Terminate()
	Wait() error
	SetStdout(stdout io.Writer)
	SetStderr(stderr io.Writer)
	SetStdin(stdin io.Reader)
	StdoutPipe() (io.ReadCloser, error)
	StderrPipe() (io.ReadCloser, error)
	ExitCode() int
}

Command is a wrapper to exec.Cmd. It handles context-cancellation cleanup and defines a String() method to make logging easier.

func NewCommand

func NewCommand(ctx context.Context, cmd string, args ...string) Command

NewCommand creates a new command object that's tied to the passed-in context. When cmd.Start() is invoked, the command will run in its own process group. When the context is cancelled, a SIGTERM signal will be sent to the command's process group. If after five seconds the command's process has not been terminated, then a SIGKILL signal is sent to the command's process group.

type PluginSpec

type PluginSpec struct {
	Script string
}

PluginSpec represents an external plugin's specification.

func (PluginSpec) Load

func (s PluginSpec) Load() (plugin.Root, error)

Load ensures the external plugin represents an executable artifact and create a plugin Root.

func (PluginSpec) Name

func (s PluginSpec) Name() string

Name returns the plugin name, which is the basename of the script with extension removed.

Jump to

Keyboard shortcuts

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