osutils

package module
v0.0.0-...-fd70b77 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: MIT Imports: 5 Imported by: 1

README

osutils

Golang OS utilities lib

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 Trunc

func Trunc(str string, num int) string

Trunc truncates string

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