direct

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package direct provides the default Sandbox implementation for exec hooks: it spawns the command as a local subprocess via exec.CommandContext.

This is the built-in, zero-config behavior. When ExecHookConfig.Sandbox is nil, the exec hooks fall back to direct.New() — so existing deployments get the exact same semantics they had before the Sandbox abstraction was introduced.

Index

Constants

View Source
const ModeName = "direct"

ModeName is the mode identifier under which this backend registers with sandbox.RegisterFactory.

Variables

This section is empty.

Functions

func Factory

func Factory(name string, _ map[string]any) (sandbox.Sandbox, error)

Factory is a sandbox.Factory that ignores the config block (direct mode has no configuration) and returns a ready Sandbox.

Types

type Sandbox

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

Sandbox runs exec-hook commands as local subprocesses.

func New

func New(name string) *Sandbox

New returns a direct-mode sandbox with the given display name. An empty name defaults to "direct".

func (*Sandbox) Name

func (s *Sandbox) Name() string

Name returns the configured sandbox name.

func (*Sandbox) Spawn

func (s *Sandbox) Spawn(ctx context.Context, req sandbox.Request) (sandbox.Response, error)

Spawn runs req.Command locally, piping req.Stdin into its stdin and collecting stdout and stderr. req.Env entries are merged on top of the host environment: each entry is either a bare env var name (its value is looked up on the host and forwarded) or a "KEY=value" pair (forwarded verbatim). A timeout or non-zero exit surfaces as a non-nil Response.Err.

Jump to

Keyboard shortcuts

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