utilexec

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AptGet

func AptGet() func(context.Context) *exec.Cmd

AptGet returns a command factory for apt-get with DEBIAN_FRONTEND=noninteractive.

func Ip

func Ip() func(context.Context) *exec.Cmd

Ip returns a command factory for the ip networking utility.

func MachineRun

func MachineRun(ctx context.Context, log *slog.Logger, machine string, args ...string) (string, error)

MachineRun executes a command inside the named nspawn machine using systemd-run --machine=<machine> --pipe --wait. It streams stdout at Debug and stderr at Error, and returns the captured stdout.

func Machinectl

func Machinectl() func(context.Context) *exec.Cmd

Machinectl returns a command factory for machinectl.

func OutputCmd

func OutputCmd(ctx context.Context, logger *slog.Logger, name string, args ...string) (string, error)

OutputCmd runs the command specified by name and args, streams stdout at Debug and stderr at Error, and returns the captured stdout as a string. Unlike RunCmd it does not require a command factory - just a binary path.

func RunCmd

func RunCmd(ctx context.Context, logger *slog.Logger, newCmd func(context.Context) *exec.Cmd, args ...string) error

RunCmd creates a command from the given factory, appends args, streams stdout at Debug and stderr at Error, and waits for it to finish.

func Sysctl

func Sysctl() func(context.Context) *exec.Cmd

Sysctl returns a command factory for sysctl.

func Systemctl

func Systemctl() func(context.Context) *exec.Cmd

Systemctl returns a command factory for systemctl.

Types

This section is empty.

Jump to

Keyboard shortcuts

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