Documentation
¶
Overview ¶
Local Exec
The "local exec" implementation of the command interface is roughly equvalent to the LocalCommand interface; however, it does not enforce the use of any shell and
Index ¶
- Constants
- Variables
- func KillSpawnedProcs(key string, logger grip.Journaler) error
- func TrackProcess(key string, pid int, logger grip.Journaler)
- type CacheLastWritten
- type Command
- func NewLocalCommand(cmdString, workingDir, shell string, env []string, scriptMode bool) Command
- func NewLocalExec(binary string, args []string, env map[string]string, workingdir string) (Command, error)
- func NewRemoteCommand(cmd, hostname, user string, env map[string]string, background bool, ...) Command
- func NewSCPCommand(src, dest, hostname, user string, options []string) Command
- type OutputOptions
Constants ¶
View Source
const ( // IMPORTANT: this user must be configured for passwordless ssh to // localhost on the machine where the unit tests are run, using the key // above TestRemoteUser = "mcitestuser" TestRemote = "localhost" )
View Source
const ( MarkerTaskID = "EVR_TASK_ID" MarkerAgentPID = "EVR_AGENT_PID" )
Variables ¶
View Source
var ( // IMPORTANT: this key must be attached to the user below for // passwordless ssh to localhost on the machine where the unit tests are // run TestRemoteKey = os.ExpandEnv("${HOME}/.ssh/mcitest") )
Functions ¶
func KillSpawnedProcs ¶
KillSpawnedProcs cleans up any tasks that were spawned by the given task.
Types ¶
type CacheLastWritten ¶
type CacheLastWritten struct {
LastWritten []byte
}
A trivial implementation of io.Writer that saves the last thing written. Useful for some testing situations where a line of stdout or stderr needs to be checked.
type Command ¶
type Command interface {
// Run Provides a wrapper around start and wait, that provides
// a blocking operation, with the ability to cancel the operation
// via the context.
Run(context.Context) error
Start(context.Context) error
Wait() error
Stop() error
GetPid() int
SetOutput(OutputOptions) error
}
Command provides a common interface for the three methods of managing commands in evergreen
func NewLocalCommand ¶
func NewLocalExec ¶
func NewRemoteCommand ¶
func NewSCPCommand ¶
type OutputOptions ¶
type OutputOptions struct {
Output io.Writer `json:"-"`
Error io.Writer `json:"-"`
SuppressOutput bool `json:"suppress_output"`
SuppressError bool `json:"suppress_error"`
SendOutputToError bool `json:"redirect_output_to_error"`
SendErrorToOutput bool `json:"redirect_error_to_output"`
}
OutputOptions provides a common way to define and represent the output behavior of a evergreen/subprocess.Command operation.
func (OutputOptions) GetError ¶
func (o OutputOptions) GetError() io.Writer
func (OutputOptions) GetOutput ¶
func (o OutputOptions) GetOutput() io.Writer
func (OutputOptions) Validate ¶
func (o OutputOptions) Validate() error
Click to show internal directories.
Click to hide internal directories.