command

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombinedOutput

func CombinedOutput(ctx context.Context, dir string, environ expand.Environ, cmd string, args ...string) ([]byte, error)

func Command

func Command(ctx context.Context, dir string, environ expand.Environ, stdout io.Writer, stderr io.Writer, stdin io.Reader, cmd string, args ...string) error

func FormatCommandName

func FormatCommandName(cmd string, args []string) string

func ListVars

func ListVars(environ expand.Environ) map[string]string

func Output

func Output(ctx context.Context, dir string, environ expand.Environ, cmd string, args ...string) ([]byte, error)

func ShouldExecuteOnOS

func ShouldExecuteOnOS(os string) bool

Types

type FakeCommand

type FakeCommand struct {
	OutputBytes []byte
}

FakeCommand is used for testing

func (*FakeCommand) CombinedOutput

func (f *FakeCommand) CombinedOutput() ([]byte, error)

CombinedOutput runs the command and returns the stdout and stderr

func (*FakeCommand) Output

func (f *FakeCommand) Output() ([]byte, error)

Output runs the command and returns the stdout

func (*FakeCommand) Run

func (f *FakeCommand) Run(workingDirectory string, stdout io.Writer, stderr io.Writer, stdin io.Reader) error

Run implements interface

func (*FakeCommand) RunWithEnv

func (f *FakeCommand) RunWithEnv(stdout io.Writer, stderr io.Writer, stdin io.Reader, dir string, extraEnvVars map[string]string) error

RunWithEnv Run implements interface

Jump to

Keyboard shortcuts

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