cmdlib

package
v0.0.0-...-7a729f8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConcurrencyRun

func ConcurrencyRun(name string, adapter ConcurrencyRunAdapter) (err error)

执行操作系统脚本或命令的方法

func ReplaceCmdNameByEnv

func ReplaceCmdNameByEnv(name string, envs []string) string

func RunShellCommandBytes

func RunShellCommandBytes(cmdStr []string) (out []byte, err error)

同步执行操作系统命令的方法(获取命令返回值) RunShellCommandString 执行shell命令,返回[]byte(包含stderr 和 stdout)

func RunShellCommandString

func RunShellCommandString(cmdStr []string) (out string, err error)

同步执行操作系统命令的方法(获取命令返回值) RunShellCommandString 执行shell命令,返回字符串

Types

type ConcurrencyRunAdapter

type ConcurrencyRunAdapter interface {
	GetDir() (string, bool)     //获取命令执行路径,bool为false时不需要设置
	DealStdOut(string) error    //标准输出
	DealStdErr(string) error    //标准错误输出
	GetTimeOut() time.Duration  //超时时间
	GetEnvs() map[string]string //需要预置的环境变量
	CloseLogFile() error        //关闭日志文件
	ErrResult() error           //获取执行结果是否错误
}

执行操作系统脚本或命令所依赖的对象

type InstructionLogPrint

type InstructionLogPrint interface {
	IsLogPrint() bool // 自定义是否输出日志
}

type InstructionParamsSeparator

type InstructionParamsSeparator interface {
	Separator() string // 自定义命令行参数分隔符
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL