command

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIsolatedCommand

func NewIsolatedCommand(ctx context.Context, mountPoints []MountPoint, args ...string) *exec.Cmd

NewIsolatedCommand runs a Command in isolation using BubbleWrap.

Types

type Command

type Command interface {
	Exec(ctx context.Context) error
}

Command can be executed.

type MountPoint

type MountPoint struct {
	Host   string
	Target string
}

MountPoint defines how a directory should be mounted.

type WithTimeout

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

WithTimeout is a helper Command that wraps a Command and adds an execution timeout.

func NewWithTimeout

func NewWithTimeout(command Command, timeout time.Duration) WithTimeout

NewWithTimeout creates a new WithTimeout.

func (WithTimeout) Exec

func (c WithTimeout) Exec(ctx context.Context) error

Exec calls the underlying Command with a timeout.

type WorkerPool

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

WorkerPool is a pool of worker for executing commands limiting the maximum number of concurrent commands.

func NewWorkerPool

func NewWorkerPool(maxSlots int, maxWaitQueueDepth int) *WorkerPool

NewWorkerPool creates a new WorkerPool. When workers are not available, the Spawn method wait until one is available: - maxSlots controls the maximum number of concurrent workers. - maxWaitQueueDepth controls how many commands can wait for a worker to be available.

func (*WorkerPool) Spawn

func (s *WorkerPool) Spawn(ctx context.Context, command Command) error

Spawn spawns a Command.

Jump to

Keyboard shortcuts

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