remote

package
v0.0.0-...-d0ab2d1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	// Command is the command to run remotely. This is executed as if
	// it were a shell command, so you are expected to do any shell escaping
	// necessary.
	Command string

	// Stdin specifies the process's standard input. If Stdin is
	// nil, the process reads from an empty bytes.Buffer.
	Stdin io.Reader

	// Stdout and Stderr represent the process's standard output and
	// error.
	//
	// If either is nil, it will be set to ioutil.Discard.
	Stdout io.Writer
	Stderr io.Writer

	// This thing is a mutex, lock when making modifications concurrently
	sync.Mutex
	// contains filtered or unexported fields
}

Cmd represents a remote command being prepared or run.

func (*Cmd) Init

func (c *Cmd) Init()

Init must be called by the Communicator before executing the command.

func (*Cmd) SetExitStatus

func (c *Cmd) SetExitStatus(status int, err error)

SetExitStatus stores the exit status of the remote command as well as any communicator related error. SetExitStatus then unblocks any pending calls to Wait. This should only be called by communicators executing the remote.Cmd.

func (*Cmd) Wait

func (c *Cmd) Wait() error

Wait waits for the remote command to complete. Wait may return an error from the communicator, or an ExitError if the process exits with a non-zero exit status.

type ExitError

type ExitError struct {
	Command    string
	ExitStatus int
	Err        error
}

ExitError is returned by Wait to indicate and error executing the remote command, or a non-zero exit status.

func (*ExitError) Error

func (e *ExitError) Error() string

Jump to

Keyboard shortcuts

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