Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunCmdOutput ¶
Executes an external process and returns its output. If the returned output is not needed, use the RunCmd function instead , for better performance.
func RunCmdWithOutputParser ¶
func RunCmdWithOutputParser(config CmdConfig, prompt bool, regExpStruct ...*CmdOutputPattern) (stdOut string, errorOut string, exitOk bool, err error)
Executes the command and captures the output. Analyze each line to match the provided regex. Returns the complete stdout output of the command.
Types ¶
type CmdConfig ¶
type CmdConfig interface {
GetCmd() *exec.Cmd
GetEnv() map[string]string
GetStdWriter() io.WriteCloser
GetErrWriter() io.WriteCloser
}
type CmdOutputPattern ¶
type CmdOutputPattern struct {
RegExp *regexp.Regexp
MatchedResults [][]string
Line string
ExecFunc func(pattern *CmdOutputPattern) (string, error)
}
RegExp - The regexp that the line will be searched upon. MatchedResults - The slice result that was found by the regex Line - The output line from the external process ExecFunc - The function to execute
Click to show internal directories.
Click to hide internal directories.