Documentation ¶
Overview ¶
Package localexec provides constructs for uniform execution of local processes, specifically conversion from model.Cmd to exec.Cmd.
Index ¶
- func OneShotToLogger(ctx context.Context, execer Execer, cmd model.Cmd) error
- type Env
- type Execer
- type FakeCall
- type FakeExecer
- func (f *FakeExecer) Calls() []FakeCall
- func (f *FakeExecer) RegisterCommand(cmd string, exitCode int, stdout string, stderr string)
- func (f *FakeExecer) RegisterCommandBytes(cmd string, exitCode int, stdout []byte, stderr []byte)
- func (f *FakeExecer) RegisterCommandError(cmd string, err error)
- func (f *FakeExecer) Run(ctx context.Context, cmd model.Cmd, runIO RunIO) (exitCode int, err error)
- type OneShotResult
- type ProcessExecer
- type RunIO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Env ¶ added in v0.22.1
type Env struct {
// contains filtered or unexported fields
}
Common environment for local exec commands.
func (*Env) ExecCmd ¶ added in v0.22.1
ExecCmd creates a stdlib exec.Cmd instance suitable for execution by the local engine.
The resulting command will inherit the parent process (i.e. `tilt`) environment, then have command specific environment overrides applied, and finally, additional conditional environment to improve logging output.
NOTE: To avoid confusion with ExecCmdContext, this method accepts a logger instance directly rather than using logger.Get(ctx); the returned exec.Cmd from this function will NOT be associated with any context.
type FakeExecer ¶ added in v0.23.0
type FakeExecer struct {
// contains filtered or unexported fields
}
func NewFakeExecer ¶ added in v0.23.0
func NewFakeExecer(t testing.TB) *FakeExecer
func (*FakeExecer) Calls ¶ added in v0.23.0
func (f *FakeExecer) Calls() []FakeCall
func (*FakeExecer) RegisterCommand ¶ added in v0.23.0
func (f *FakeExecer) RegisterCommand(cmd string, exitCode int, stdout string, stderr string)
RegisterCommand adds or replaces a command to the FakeExecer.
If the output strings are not newline terminated, a newline will automatically be added. If this behavior is not desired, use `RegisterCommandBytes`.
func (*FakeExecer) RegisterCommandBytes ¶ added in v0.23.0
func (f *FakeExecer) RegisterCommandBytes(cmd string, exitCode int, stdout []byte, stderr []byte)
RegisterCommandBytes adds or replaces a command to the FakeExecer.
The output values will be used exactly as-is, so can be used to simulate processes that do not newline terminate etc.
func (*FakeExecer) RegisterCommandError ¶ added in v0.23.0
func (f *FakeExecer) RegisterCommandError(cmd string, err error)
type OneShotResult ¶ added in v0.23.0
type OneShotResult struct { // ExitCode from the process ExitCode int // Stdout from the process Stdout []byte // Stderr from the process Stderr []byte }
OneShotResult includes details about command execution.
type ProcessExecer ¶ added in v0.23.0
type ProcessExecer struct {
// contains filtered or unexported fields
}
func NewProcessExecer ¶ added in v0.23.0
func NewProcessExecer(env *Env) *ProcessExecer