cmd

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	*exec.Cmd
}

Cmd is a wrapper around exec.Cmd with sensible handling of stderr in error reports.

func NewCurl added in v0.7.6

func NewCurl(stdout, stderr *IOStream) *Cmd

func NewKraft

func NewKraft(stdout, stderr *IOStream, cfgPath string) *Cmd

NewKraft returns a kraft OS command that uses the given IO streams and has pre-set flags to use the given paths.

func NewKraftPrivileged added in v0.7.0

func NewKraftPrivileged(stdout, stderr *IOStream, cfgPath string) *Cmd

NewKraftPrivileged returns a kraft OS command that uses the given IO streams and has pre-set flags to use the given paths, with a sudo prefix if user is not already root.

func (*Cmd) DumpError added in v0.7.0

func (c *Cmd) DumpError(stdoutio, stderrio *IOStream, err error) string

DumpError is a common method used across command executions which is used to standardize the output display of the command which was invoked along with the stdout and stderr.

func (*Cmd) Run

func (c *Cmd) Run() error

Run runs the command, and automatically injects the output to stderr in the returned ExitError, in case such an error occurs. It is similar to (*exec.Cmd).Output, but allows the command to have stdout explicitly set.

type ExitError

type ExitError struct {
	*exec.ExitError
}

ExitError is a wrapper around exec.ExitError that can be pretty-printed through a gomega matcher.

func (*ExitError) GomegaString

func (e *ExitError) GomegaString() string

type IOStream

type IOStream struct {
	// contains filtered or unexported fields
}

IOStream represents an IO stream to be used by OS commands and suitable for assertions and reporting in tests.

func NewIOStream

func NewIOStream() *IOStream

NewIOStream returns an initialized IOStream.

func (*IOStream) GomegaString

func (s *IOStream) GomegaString() string

func (*IOStream) Read

func (s *IOStream) Read(p []byte) (n int, err error)

func (*IOStream) String

func (s *IOStream) String() string

func (*IOStream) Write

func (s *IOStream) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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