Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommandResult ¶
type CommandResult struct {
Stdout bytes.Buffer
Stderr bytes.Buffer
Status int
Success bool
Err error
}
func RunBashCommand ¶ added in v0.0.2
func RunBashCommand(command string, ops ...Option) *CommandResult
RunBashCommand 把入参当作一段 shell 源码交给内置解释器执行, 支持管道、重定向、变量展开等 bash 语法。
func RunCommand ¶
func RunCommand(command []string, ops ...Option) *CommandResult
RunCommand 按 argv 形式执行命令。 内部会把参数做 POSIX shell 转义后拼成一行脚本,再交给解释器执行, 因此参数里的空格、引号、$ 等不会被二次解释,等价于直接 exec 的语义。
func RunCommandForLast ¶
func RunCommandForLast(commands [][]string, ops ...Option) (bool, *CommandResult)
RunCommandForLast run commands and return last result
func (*CommandResult) OutputOrFatal ¶
func (r *CommandResult) OutputOrFatal()
func (*CommandResult) SimpleLog ¶ added in v0.0.3
func (r *CommandResult) SimpleLog() string
Click to show internal directories.
Click to hide internal directories.