Documentation ¶
Overview ¶
Package exec supplies some convenient execution functions.
Index ¶
- Variables
- func CopyFilesFromRemoteBySSH(remoteHost, localDirOrFile string, remoteFiles ...string) error
- func CopyFilesToRemoteBySSH(remoteHost, remoteDirOrFile string, localFiles ...string) error
- func Execute(name string, args ...string) error
- func ExecuteCmdBySSH(host, cmd string) (stdout, stderr string, err error)
- func ExecuteScriptBySSH(host, script string) (stdout, stderr string, err error)
- func Executes(cmds ...string) error
- func LogExecutedCmdResultHook(name string, args []string, stdout, stderr []byte, err error) ([]byte, []byte, error)
- func MustExecute(name string, args ...string)
- func MustExecutes(cmds ...string)
- func MustOutput(name string, args ...string) string
- func MustOutputs(cmds ...string) string
- func Output(name string, args ...string) (string, error)
- func Outputs(cmds ...string) (string, error)
- func PanicExecute(name string, args ...string)
- func PanicExecutes(cmds ...string)
- func PanicOutput(name string, args ...string) string
- func PanicOutputs(cmds ...string) string
- func SetDefaultCmdLock(lock *sync.Mutex)
- func SetDefaultCmdLogHook()
Constants ¶
This section is empty.
Variables ¶
var SSHOptions = "-o StrictHostKeyChecking=no"
SSHOptions is the options of ssh/scp command.
var SSHUser = "root"
SSHUser is the user to execute the shell command by SSH.
Functions ¶
func CopyFilesFromRemoteBySSH ¶ added in v0.15.0
CopyFilesFromRemoteBySSH copies the files from the remote to the local.
func CopyFilesToRemoteBySSH ¶ added in v0.15.0
CopyFilesToRemoteBySSH copies the files from the local to the remote.
func ExecuteCmdBySSH ¶ added in v0.15.0
ExecuteCmdBySSH executes the shell command by SSH.
func ExecuteScriptBySSH ¶ added in v0.15.0
ExecuteScriptBySSH executes the shell script by SSH.
func LogExecutedCmdResultHook ¶
func LogExecutedCmdResultHook(name string, args []string, stdout, stderr []byte, err error) ([]byte, []byte, error)
LogExecutedCmdResultHook returns a hook to log the executed command.
func MustExecute ¶
MustExecute is the same as Execute, but the program exits if there is an error.
func MustExecutes ¶
func MustExecutes(cmds ...string)
MustExecutes is the equal to MustExecute(cmds[0], cmds[1:]...).
func MustOutput ¶
MustOutput is the same as Execute, but the program exits if there is an error.
func MustOutputs ¶
MustOutputs is the equal to MustOutput(cmds[0], cmds[1:]...).
func PanicExecute ¶
PanicExecute is the same as MustExecute, but panic instead of exiting.
func PanicExecutes ¶
func PanicExecutes(cmds ...string)
PanicExecutes is the equal to MustExecute(cmds[0], cmds[1:]...).
func PanicOutput ¶
PanicOutput is the same as MustOutput, but panic instead of exiting.
func PanicOutputs ¶
PanicOutputs is the equal to MustOutput(cmds[0], cmds[1:]...).
func SetDefaultCmdLock ¶ added in v0.15.0
SetDefaultCmdLock sets the lock of the default command executor to lock.
func SetDefaultCmdLogHook ¶
func SetDefaultCmdLogHook()
SetDefaultCmdLogHook sets the log hook for the default command executor.
Types ¶
This section is empty.