Documentation ¶
Index ¶
- func IsRoot() bool
- func Run(cmd string) error
- func RunAndReturnOutput(cmd string) (b []byte, err error)
- func RunAndReturnOutputToFile(cmd, path string) error
- func RunInBash(bash string) error
- func RunSlice(args []string) error
- func SetCmdEnv(cmd *exec.Cmd, key, value string) error
- func StdioRun(cmd string) error
- func StdioRunSlice(args []string) error
- func Which(cmd string) bool
- func WhoAMI() string
- type Cmd
- func (c *Cmd) FprintCmdLine(w io.Writer)
- func (c *Cmd) GetExecCmd() *exec.Cmd
- func (c *Cmd) PrintCmdLine()
- func (c *Cmd) Run() error
- func (c *Cmd) RunAndReturnOutput() (b []byte, err error)
- func (c *Cmd) RunAndReturnOutputToFile(path string) error
- func (c *Cmd) SetDir(path string)
- func (c *Cmd) SetEnv(key, value string) error
- func (c *Cmd) StdioRun() error
- type Env
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunAndReturnOutput ¶
RunAndReturnOutput 执行命令,输出结果到byte数组中
func RunAndReturnOutputToFile ¶
RunAndReturnOutputToFile 执行命令,输出到文件path中
Types ¶
type Cmd ¶
type Cmd struct {
// contains filtered or unexported fields
}
Cmd 对于系统cmd的包装
func (*Cmd) FprintCmdLine ¶
func (*Cmd) RunAndReturnOutput ¶
RunAndReturnOutput 回显命令,并且运行,返回运行的输出结果.并且把输出结果放在stdout中
func (*Cmd) RunAndReturnOutputToFile ¶
RunAndReturnOutputToFile 回显命令,并且运行,将运行的输出结果放在文件path中
Click to show internal directories.
Click to hide internal directories.