Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecResponse ¶
ExecResponse contains the return code and output generated by executing a command.
func RunCommands ¶
func RunCommands(run RunParams) (*ExecResponse, error)
RunCommands executes the Commands specified in the RunParams using powershell on windows, and '/bin/bash -s' on everything else, passing the commands through as stdin, and collecting stdout and stderr. If a non-zero return code is returned, this is collected as the code for the response and this does not classify as an error.
type RunParams ¶
type RunParams struct { Commands string WorkingDir string Environment []string // contains filtered or unexported fields }
Parameters for RunCommands. Commands contains one or more commands to be executed using '/bin/bash -s'. If WorkingDir is set, this is passed through to bash. Similarly if the Environment is specified, this is used for executing the command.
func (*RunParams) Process ¶
Process returns the *os.Process instance of the current running process This will allow us to kill the process if needed, or get more information on the process
func (*RunParams) Run ¶
Run sets up the command environment (environment variables, working dir) and starts the process. The commands are passed into '/bin/bash -s' through stdin on Linux machines and to powershell on Windows machines.
func (*RunParams) Wait ¶
func (r *RunParams) Wait() (*ExecResponse, error)
Wait blocks until the process exits, and returns an ExecResponse type containing stdout, stderr and the return code of the process. If a non-zero return code is returned, this is collected as the code for the response and this does not classify as an error.