system

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutionResult

type ExecutionResult struct {
	Stdout   []byte
	Stderr   []byte
	ExitCode int
}

func Execute

func Execute(ctx context.Context, system System, command string) (*ExecutionResult, error)

Execute runs a command on a system and returns an ExecutionResult. Execute implicitly records stdout and stderr and provides them in the ExecutionResult. Execute provides a higher abstraction than Command.

type Executor

type Executor interface {
	Execute(context.Context, cmd.Command) (cmd.Result, error)
}

type FileSystem

type FileSystem interface {
	ReadFS
	WriteFS
	StatFS
}

FileSystem provides read and write access to a file system.

type ReadFS

type ReadFS interface {
	Open(ctx context.Context, name string) (fs.File, error)
}

ReadFS provides read access to a file system. ReadFS has support for context.Context in addition to the similar fs.FS.

type StatFS

type StatFS interface {
	Stat(ctx context.Context, name string) (fs.FileInfo, error)
}

type System

type System interface {
	io.Closer
	FileSystem
	Executor
}

System is an interface to access a file system of and execute commands on a system.

type WriteFS

type WriteFS interface {
	// Create creates or truncates the named file. If the file already exists,
	// it is truncated. If the file does not exist, it is created.
	// The size of the file must be known in advance.
	Create(ctx context.Context, fileInfo fs.FileInfo) (WriteFile, error)
}

WriteFS provides write access to a file system.

type WriteFile

type WriteFile interface {
	io.Writer
	io.Closer
}

WriteFile provides write access to a single file

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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