executor

package
v0.0.0-...-263e7da Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package executor abstracts OS command execution. Collectors that need to shell out (sysctl, sw_vers, lsb_release, loginctl, lscpu, etc.) accept an Executor so tests can assert the command + args and return canned stdout via a gomock-generated mock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor interface {
	Execute(
		ctx context.Context,
		name string,
		args ...string,
	) ([]byte, error)
}

Executor runs OS commands and returns their combined stdout+stderr. Context cancellation propagates to the underlying process via exec.CommandContext — collectors can honor deadlines and SIGINT.

Shape is intentionally minimal (single method, combined output). Matches osapi's CommandExecutor with one addition: we thread context for cancellation, osapi passes timeout as an integer.

func New

func New() Executor

New returns the production Executor implementation.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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