cmd

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: Unlicense Imports: 7 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunErrOnly added in v0.12.0

func RunErrOnly(in Input) error

RunErrOnly runs a command and on any errors returns an error and ignores the output.

func RunNoOut added in v0.11.0

func RunNoOut(in Input) error

RunNoOut runs a command and discards its output.

Types

type Input

type Input struct {
	Command         string
	CmdSlice        []string
	Env             map[string]string
	Pwd             string
	Shell           bool
	ShellCmd        string
	Sudo            bool
	SudoPreserveEnv bool
}

Input represents configuration for a command to be executed.

type OutBuffer added in v0.13.0

type OutBuffer struct {
	Code   int
	Stdout bytes.Buffer
	Stderr bytes.Buffer
}

OutBuffer represents the response from an executed command where stdout and stderr are store as buffers.

func RunOutBuffer added in v0.13.0

func RunOutBuffer(in Input) (OutBuffer, error)

RunOutBuffer runs a command based on the Input and returns an OutBuffer.

type Output

type Output struct {
	Code   int
	Stdout string
	Stderr string
}

Output represents the response from an executed command.

func Run

func Run(in Input) (Output, error)

Run runs a command based on the CmdIn input and returns a CmdOut.

func RunFmtErr added in v0.11.0

func RunFmtErr(in Input) (Output, error)

RunFmtErr runs a command and on any errors returns an error which contains stdout and stderr output if any.

Jump to

Keyboard shortcuts

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