Documentation
¶
Index ¶
- func Command(ctx context.Context, name string, args ...string) *exec.Cmd
- func Exec(ctx context.Context, shell string) (string, error)
- func ExecWithLog(ctx context.Context, shell string, logFile string) error
- func ExecWithLogAppend(ctx context.Context, shell string, logFile string) error
- func ExecWithOutput(ctx context.Context, shell string) error
- func ExecWithPipe(ctx context.Context, shell string) (io.ReadCloser, error)
- func ExecWithStdinProgress(ctx context.Context, name string, args, env []string, stdin io.Reader, ...) (string, error)
- func Execf(ctx context.Context, format string, args ...any) (string, error)
- func ExecfAsync(ctx context.Context, format string, args ...any) error
- func ExecfWithDir(ctx context.Context, dir, format string, args ...any) (string, error)
- func ExecfWithEnv(ctx context.Context, env []string, format string, args ...any) (string, error)
- func ExecfWithTimeout(ctx context.Context, timeout time.Duration, format string, args ...any) (string, error)
- func Quote(s string) string
- type MessagePing
- type MessageResize
- type Turn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecWithLogAppend ¶ added in v3.3.6
func ExecWithOutput ¶ added in v3.3.6
ExecWithOutput 执行已拼好的 shell 命令并输出到终端
func ExecWithPipe ¶ added in v3.3.6
ExecWithPipe stdout 与 stderr 合并成流,命令失败时读端收到错误
func ExecWithStdinProgress ¶ added in v3.3.1
func ExecWithStdinProgress( ctx context.Context, name string, args, env []string, stdin io.Reader, total int64, interval time.Duration, progress func(written, total int64, rate float64), ) (string, error)
ExecWithStdinProgress 以外部命令消费 stdin,同时按周期通过 progress 回调输出进度
func ExecfWithDir ¶
func ExecfWithEnv ¶ added in v3.3.2
func ExecfWithTimeout ¶
Types ¶
type MessageResize ¶
type MessageResize struct {
Resize bool `json:"resize"`
Columns uint `json:"columns"`
Rows uint `json:"rows"`
}
MessageResize 终端大小调整消息
Click to show internal directories.
Click to hide internal directories.