gohcmd

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecShell

func ExecShell(command string) (string, error)

ExecShell execute a shell command (like bash -c 'your command')

func ExecShellTimeout

func ExecShellTimeout(command string, timeout time.Duration, ctx *ShellContext) (string, error)

ExecShellTimeout execute a shell command (like bash -c 'your command') with a timeout. After that time, the process will be cancelled

func ExecShellf

func ExecShellf(command string, args ...interface{}) (string, error)

ExecShellf execute a shell command (like bash -c 'your command') but with format replacements

func GetCmdOutput

func GetCmdOutput(cmd *cmd.Cmd) string

GetCmdOutput join stdout and stderr in a single string from Cmd

func GracefulStop

func GracefulStop(cancel context.CancelFunc)

GracefulStop cancels gracefully the running goRoutines

Types

type ShellContext

type ShellContext struct {
	//CmdRef cmd.Cmd pointer that can be used to set command references that should be killed when a backup deletion of a running job is detected
	CmdRef *cmd.Cmd
}

ShellContext container to transport a Cmd reference

Jump to

Keyboard shortcuts

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