Documentation ¶
Overview ¶
Package host provides facilities for interfacing with the host operating system, logging activities performed.
Index ¶
- func CombinedOutput(name string, arg ...string) (combinedOutput string, err error)
- func ImmediateReboot()
- func ImmediateShutdown(cause string)
- func Run(name string, arg ...string) (err error)
- func RunBatch(allowFail bool, commands ...[]string) (err error)
- func RunCommand(cmd *exec.Cmd) (combinedOutput string, err error)
- func RunIgnoreError(errString string, command string, args ...string) (found bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombinedOutput ¶
CombinedOutput is equivalent to exec.Command(name, arg...).CombinedOutput() but with logging.
func ImmediateReboot ¶
func ImmediateReboot()
func ImmediateShutdown ¶
func ImmediateShutdown(cause string)
func RunBatch ¶
RunBatch calls Run for each command in commands, in sequence. If allowFail is false it will return if an error is returned from Run. All errors are logged regardless of allowFail. The returned error is the result of the last Run call.
func RunCommand ¶
RunCommand logs cmd.Args, calls cmd.CombinedOutput(), and if an error occurs, logs the command output. It does not log the error, it is expected that the caller takes care of logging error, if required. The caller is not expected to log the command output in the case of failure, since this function has already done that. The combined output is cast to a string and returned together with the error.
func RunIgnoreError ¶
RunIgnoreError calls CombinedOutput(comand, args...). If errString is found in the command output, found is true and err is nil. Otherwise found is false, and err is the error returned from CombinedOutput (possibly nil).
Types ¶
This section is empty.