cmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

README

// 调用示例

ctx := context.Background()
	str, err := cmd.ExecShell(ctx, "ls -al")
	fmt.Println("---str:", str, "err:", err)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCmd added in v0.1.0

func CheckCmd(cmd string) bool

func ExecCommand added in v0.1.0

func ExecCommand(cmdStr string) (msg string, err error)

func ExecSSHCmdByKey added in v0.1.0

func ExecSSHCmdByKey(host, user, key, command string) (string, error)

func ExecSSHCmdByPwd added in v0.1.0

func ExecSSHCmdByPwd(host, user, password, command string) (string, error)

func ExecShell

func ExecShell(ctx context.Context, command string) (string, error)

执行shell命令,可设置执行超时时间

Types

type Result

type Result struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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