Documentation
¶
Index ¶
- func CommandExists(command string) bool
- func ExecBackground(command string) (*exec.Cmd, error)
- func ExecCombined(command string) (string, error)
- func ExecResultBytes(command string) ([]byte, error)
- func ExecResultStr(command string) (string, error)
- func ExecStream(command string, onOutput func(line string)) error
- func ExecStreamWithContext(ctx context.Context, command string, onOutput func(line string)) error
- func ExecSuccess(command string) bool
- func ExecWithDir(command string, dir string) (string, error)
- func ExecWithEnv(command string, env map[string]string) (string, error)
- func ExecWithTimeout(command string, timeout time.Duration) (string, error)
- func KillProcess(pid int) error
- func KillProcessGroup(pgid int) error
- func Which(command string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecBackground ¶
ExecBackground 后台执行命令(不等待完成)
func ExecResultBytes ¶
ExecResultBytes 执行命令并返回字节数组
func ExecStream ¶
ExecStream 流式输出命令执行结果
func ExecStreamWithContext ¶
ExecStreamWithContext 带上下文的流式命令执行
func ExecWithDir ¶
ExecWithDir 在指定目录执行命令
func ExecWithEnv ¶
ExecWithEnv 带环境变量执行命令
func ExecWithTimeout ¶
ExecWithTimeout 带超时的命令执行
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.