Documentation ¶
Index ¶
- Variables
- func CombinedOutputTimeout(c *exec.Cmd, timeout time.Duration) ([]byte, error)
- func GetTLSConfig(SSLCert, SSLKey, SSLCA string, InsecureSkipVerify bool) (*tls.Config, error)
- func RandomSleep(max time.Duration, shutdown chan struct{})
- func RandomString(n int) string
- func ReadLines(filename string) ([]string, error)
- func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error)
- func RunTimeout(c *exec.Cmd, timeout time.Duration) error
- func SnakeCase(in string) string
- func WaitTimeout(c *exec.Cmd, timeout time.Duration) error
- type Duration
Constants ¶
This section is empty.
Variables ¶
var ( TimeoutErr = errors.New("Command timed out.") NotImplementedError = errors.New("not implemented yet") )
Functions ¶
func CombinedOutputTimeout ¶
CombinedOutputTimeout runs the given command with the given timeout and returns the combined output of stdout and stderr. If the command times out, it attempts to kill the process.
func GetTLSConfig ¶
GetTLSConfig gets a tls.Config object from the given certs, key, and CA files. you must give the full path to the files. If all files are blank and InsecureSkipVerify=false, returns a nil pointer.
func RandomSleep ¶
RandomSleep will sleep for a random amount of time up to max. If the shutdown channel is closed, it will return before it has finished sleeping.
func RandomString ¶
RandomString returns a random string of alpha-numeric characters
func ReadLines ¶
ReadLines reads contents from a file and splits them by new lines. A convenience wrapper to ReadLinesOffsetN(filename, 0, -1).
func ReadLinesOffsetN ¶
ReadLines reads contents from file and splits them by new line. The offset tells at which line number to start. The count determines the number of lines to read (starting from offset):
n >= 0: at most n lines n < 0: whole file
func RunTimeout ¶
RunTimeout runs the given command with the given timeout. If the command times out, it attempts to kill the process.