cmd

package
v0.6.7-89-gd59cd89 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: BSD-3-Clause Imports: 8 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 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) 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