exec

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecCanceledError

func ExecCanceledError(cmd []string) *execCanceledErr

func ExecTimeoutError

func ExecTimeoutError(args []string, duration time.Duration) *execTimeoutErr

func ExecuteMockData

func ExecuteMockData(rawMockData string) int

Types

type Executor

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

func NewExecutor

func NewExecutor(path string) *Executor

func (*Executor) Format added in v0.2.0

func (e *Executor) Format(ctx context.Context, input []byte) ([]byte, error)

func (*Executor) FormatterForVersion added in v0.5.0

func (e *Executor) FormatterForVersion(v string) (Formatter, error)

func (*Executor) GetExecPath

func (e *Executor) GetExecPath() string

func (*Executor) ProviderSchemas

func (e *Executor) ProviderSchemas(ctx context.Context) (*tfjson.ProviderSchemas, error)

func (*Executor) SetExecLogPath

func (e *Executor) SetExecLogPath(path string)

func (*Executor) SetLogger

func (e *Executor) SetLogger(logger *log.Logger)

func (*Executor) SetTimeout

func (e *Executor) SetTimeout(duration time.Duration)

func (*Executor) SetWorkdir

func (e *Executor) SetWorkdir(workdir string)

func (*Executor) Version

func (e *Executor) Version(ctx context.Context) (string, error)

func (*Executor) VersionIsSupported

func (e *Executor) VersionIsSupported(ctx context.Context, c version.Constraints) error

type ExecutorFactory added in v0.4.0

type ExecutorFactory func(path string) *Executor

ExecutorFactory can be used in external consumers of exec pkg to enable easy swapping with MockExecutor

func MockExecutor

func MockExecutor(md MockItemDispenser) ExecutorFactory

type ExitError

type ExitError struct {
	Err    *exec.ExitError
	CtxErr error

	Path   string
	Stdout string
	Stderr string
}

func (*ExitError) Error

func (e *ExitError) Error() string

func (*ExitError) Unwrap

func (e *ExitError) Unwrap() error

type Formatter added in v0.5.0

type Formatter func(ctx context.Context, input []byte) ([]byte, error)

type MockCall

type MockCall MockItem

func (*MockCall) MarshalJSON

func (mc *MockCall) MarshalJSON() ([]byte, error)

func (*MockCall) NextMockItem

func (mc *MockCall) NextMockItem() *MockItem

type MockItem

type MockItem struct {
	Args          []string      `json:"args"`
	Stdout        string        `json:"stdout"`
	Stderr        string        `json:"stderr"`
	SleepDuration time.Duration `json:"sleep"`
	ExitCode      int           `json:"exit_code"`

	MockError string `json:"error"`
}

func (*MockItem) MarshalJSON

func (m *MockItem) MarshalJSON() ([]byte, error)

func (*MockItem) UnmarshalJSON

func (m *MockItem) UnmarshalJSON(b []byte) error

type MockItemDispenser

type MockItemDispenser interface {
	NextMockItem() *MockItem
}

type MockQueue

type MockQueue struct {
	Q []*MockItem
}

func (*MockQueue) NextMockItem

func (mc *MockQueue) NextMockItem() *MockItem

Jump to

Keyboard shortcuts

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