Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetUserInfo ¶
GetUserInfo 获取用户名,用户uid,用户家目录
Types ¶
type ShellConfig ¶ added in v1.2.0
type ShellConfig struct { SudoPath string // sudo命令绝对路径 ShellFile string // 生成的Shell脚本 OsType string // 系统类型 // contains filtered or unexported fields }
ShellConfig 定义命令的结构体
func ShellInit ¶
func ShellInit(password string, realtime bool) *ShellConfig
ShellInit 命令实例构造函数, 当不需要执行sudo命令的时候直接传入任意字符串给password即可 realtime 是否开启实时打印数据
func (*ShellConfig) GetStatusOutput ¶ added in v1.4.0
func (shells *ShellConfig) GetStatusOutput(cmd string) (err error, out string)
GetStatusOutput 执行命令并获取输出数据, 返回执行错误(error)及 命令输出 (字符串)
func (*ShellConfig) Shell ¶ added in v1.2.0
func (shells *ShellConfig) Shell(command string) error
Shell 执行命令并获取执行结果, 返回错误(error)
func (*ShellConfig) System ¶ added in v1.3.1
func (shells *ShellConfig) System(command string) (code int)
System 执行命令并实时获取输出,和Python的os.system函数一样,返回退出代码
type SudoConfig ¶ added in v1.4.0
type SudoConfig struct { SudoPath string // sudo命令绝对路径 ShellFile string // 生成的Shell脚本 OsType string // 系统类型 // contains filtered or unexported fields }
SudoConfig 定义命令的结构体
func SudoInit ¶ added in v1.4.0
func SudoInit(password string, realtime bool) *SudoConfig
SudoInit 命令实例构造函数, 当不需要执行sudo命令的时候直接传入任意字符串给password即可 realtime 是否开启实时打印数据
Click to show internal directories.
Click to hide internal directories.