Documentation ¶
Index ¶
- Constants
- type Execer
- type FakeExecer
- func (f *FakeExecer) Arch() string
- func (f *FakeExecer) Command(name string, arg ...string) ([]byte, error)
- func (f *FakeExecer) Getenv(key string) string
- func (f *FakeExecer) LookPath(path string) (string, error)
- func (f *FakeExecer) MkdirAll(path string, perm os.FileMode) error
- func (f *FakeExecer) OS() string
- func (f *FakeExecer) RunCommand(name string, arg ...string) error
- func (f *FakeExecer) RunCommandAndReturn(name, dir string, args ...string) (result string, err error)
- func (f *FakeExecer) RunCommandInDir(name, dir string, args ...string) error
- func (f *FakeExecer) RunCommandWithBuffer(name, dir string, stdout, stderr *bytes.Buffer, args ...string) error
- func (f *FakeExecer) RunCommandWithEnv(name string, argv, envv []string, stdout, stderr io.Writer) error
- func (f *FakeExecer) RunCommandWithIO(name, dir string, stdout, stderr io.Writer, p chan Process, args ...string) error
- func (f *FakeExecer) RunCommandWithSudo(name string, args ...string) (err error)
- func (f *FakeExecer) Setenv(key, value string) error
- func (f *FakeExecer) SystemCall(name string, argv []string, envv []string) error
- func (f *FakeExecer) WithContext(ctx context.Context) Execer
- type Process
Constants ¶
View Source
const ( // OSLinux is the alias of Linux OSLinux = "linux" // OSDarwin is the alias of Darwin OSDarwin = "darwin" // OSWindows is the alias of Windows OSWindows = "windows" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Execer ¶
type Execer interface { LookPath(string) (string, error) Command(name string, arg ...string) ([]byte, error) RunCommand(name string, arg ...string) (err error) RunCommandWithEnv(name string, argv, envv []string, stdout, stderr io.Writer) (err error) RunCommandInDir(name, dir string, args ...string) error RunCommandAndReturn(name, dir string, args ...string) (result string, err error) RunCommandWithSudo(name string, args ...string) (err error) RunCommandWithBuffer(name, dir string, stdout, stderr *bytes.Buffer, args ...string) error RunCommandWithIO(name, dir string, stdout, stderr io.Writer, p chan Process, args ...string) error SystemCall(name string, argv []string, envv []string) (err error) MkdirAll(path string, perm os.FileMode) error OS() string Arch() string Getenv(string) string Setenv(string, string) error WithContext(context.Context) Execer }
Execer is an interface for OS-related operations
func NewDefaultExecer ¶ added in v0.0.2
func NewDefaultExecer() Execer
func NewDefaultExecerWithContext ¶ added in v0.0.2
type FakeExecer ¶
type FakeExecer struct { ExpectError error ExpectLookPathError error ExpectOutput string ExpectErrOutput string ExpectOS string ExpectArch string ExpectLookPath string Env map[string]string }
FakeExecer is for the unit test purposes
func (*FakeExecer) Command ¶
func (f *FakeExecer) Command(name string, arg ...string) ([]byte, error)
Command is a fake method
func (*FakeExecer) Getenv ¶ added in v0.0.5
func (f *FakeExecer) Getenv(key string) string
Getenv returns the env value by key
func (*FakeExecer) LookPath ¶
func (f *FakeExecer) LookPath(path string) (string, error)
LookPath is a fake method
func (*FakeExecer) MkdirAll ¶
func (f *FakeExecer) MkdirAll(path string, perm os.FileMode) error
MkdirAll is the wrapper of os.MkdirAll
func (*FakeExecer) RunCommand ¶
func (f *FakeExecer) RunCommand(name string, arg ...string) error
RunCommand runs a command
func (*FakeExecer) RunCommandAndReturn ¶
func (f *FakeExecer) RunCommandAndReturn(name, dir string, args ...string) (result string, err error)
RunCommandAndReturn is a fake method
func (*FakeExecer) RunCommandInDir ¶
func (f *FakeExecer) RunCommandInDir(name, dir string, args ...string) error
RunCommandInDir is a fake method
func (*FakeExecer) RunCommandWithBuffer ¶
func (f *FakeExecer) RunCommandWithBuffer(name, dir string, stdout, stderr *bytes.Buffer, args ...string) error
RunCommandWithBuffer is a fake method
func (*FakeExecer) RunCommandWithEnv ¶ added in v0.0.2
func (f *FakeExecer) RunCommandWithEnv(name string, argv, envv []string, stdout, stderr io.Writer) error
RunCommandWithEnv is a fake method
func (*FakeExecer) RunCommandWithIO ¶
func (f *FakeExecer) RunCommandWithIO(name, dir string, stdout, stderr io.Writer, p chan Process, args ...string) error
RunCommandWithIO is a fake method
func (*FakeExecer) RunCommandWithSudo ¶
func (f *FakeExecer) RunCommandWithSudo(name string, args ...string) (err error)
RunCommandWithSudo is a fake method
func (*FakeExecer) Setenv ¶ added in v0.0.5
func (f *FakeExecer) Setenv(key, value string) error
Setenv sets the key-value pair into the env
func (*FakeExecer) SystemCall ¶
func (f *FakeExecer) SystemCall(name string, argv []string, envv []string) error
SystemCall is a fake method
func (*FakeExecer) WithContext ¶ added in v0.0.3
func (f *FakeExecer) WithContext(ctx context.Context) Execer
Click to show internal directories.
Click to hide internal directories.