exec

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package exec wraps os/exec with a small surface tailored to the wizard: run a command, collect combined output, return a Result. Prereq checks against PATH.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(name string) bool

Check returns true if `name` exists on PATH.

Types

type Result

type Result struct {
	Cmd      string   // pretty-printed command line
	Output   []string // combined stdout+stderr, one entry per line
	Err      error    // non-nil if the command failed (non-zero exit or run error)
	Duration time.Duration
}

Result captures the outcome of a single command invocation.

func Run

func Run(name string, args ...string) Result

Run executes name with args, captures combined output (stdout+stderr), and returns a Result. The command runs with a sane default timeout (5 minutes). For long-running installs that exceed this, call RunWithContext.

func RunWithContext

func RunWithContext(ctx context.Context, name string, args ...string) Result

RunWithContext is Run with a caller-supplied context (cancellation, custom timeout).

func (Result) LastLine

func (r Result) LastLine() string

LastLine returns the final non-empty output line from the Result, useful for summary rendering. Returns "" if there's no output.

Jump to

Keyboard shortcuts

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