command

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package command provides interfaces and implementations for executing commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerClient added in v0.0.2

type DockerClient interface {
	// ImagePull requests the docker host to pull an image from a remote registry.
	ImagePull(ctx context.Context, ref string, options image.PullOptions) (io.ReadCloser, error)
	// ContainerCreate creates a new container based in the given configuration.
	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *v1.Platform, containerName string) (container.CreateResponse, error)
	// ContainerStart sends a request to the docker daemon to start a container.
	ContainerStart(ctx context.Context, containerID string, options container.StartOptions) error
	// ContainerRemove kills and removes a container from the docker host.
	ContainerRemove(ctx context.Context, containerID string, options container.RemoveOptions) error
	// ContainerLogs returns the logs generated by a container in an io.ReadCloser.
	ContainerLogs(ctx context.Context, container string, options container.LogsOptions) (io.ReadCloser, error)
	// ContainerWait waits until the specified container is in a certain state.
	ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
	// ContainerAttach attaches to a container to read its output or write input.
	ContainerAttach(ctx context.Context, container string, options container.AttachOptions) (types.HijackedResponse, error)
	// Close closes the client and releases any associated resources.
	Close() error
}

DockerClient interface matching the subset of docker client methods used.

type Executor

type Executor interface {
	// Execute executes a command and returns the stdout and stderr as streams.
	Execute(ctx context.Context, command string, args []string, workingDir string, env []string) (stdout, stderr io.ReadCloser, exitCode <-chan int, err error)
	// ExecuteWithStdIO executes a command and returns the stdin, stdout, and stderr as streams.
	ExecuteWithStdIO(ctx context.Context, command string, args []string, workingDir string, env []string) (stdin io.WriteCloser, stdout, stderr io.ReadCloser, exitCode <-chan int, err error)
}

Executor is an interface for executing commands.

func NewExecutor

func NewExecutor(containerEnv *configv1.ContainerEnvironment) Executor

NewExecutor creates a new command executor.

func NewLocalExecutor

func NewLocalExecutor() Executor

NewLocalExecutor creates a new local command executor.

Jump to

Keyboard shortcuts

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