executor

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerExecutor

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

func (DockerExecutor) Close

func (e DockerExecutor) Close() error

Close stops previously started container by sending "exit" to shell - it is much faster than stopping with container API

func (DockerExecutor) Exec

func (e DockerExecutor) Exec(cmd []string) ([]byte, []byte, int, error)

Exec executes a command inside the container

func (DockerExecutor) ReadDir

func (e DockerExecutor) ReadDir(path string) (io.ReadCloser, error)

ReadDir reads the files from container directory and returns the content as TAR stream

func (DockerExecutor) ReadFile

func (e DockerExecutor) ReadFile(path string) ([]byte, error)

Read reads the file from container and returns its content

type Executor

type Executor interface {
	Exec(cmd []string) (stdout, stderr []byte, exitCode int, err error)
	ReadFile(path string) ([]byte, error)
	ReadDir(path string) (io.ReadCloser, error)
	Close() error
}

func NewDockerExecutor

func NewDockerExecutor(image string) (Executor, error)

NewDockerExecutor starts a new container and returns an executor for the container

Jump to

Keyboard shortcuts

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