Documentation
¶
Overview ¶
Package execpath finds the external programs the app runs (gh, git, claude) and runs them.
An app started from the Finder or the Dock inherits launchd's minimal PATH, which lacks Homebrew, ~/.local/bin, and other common install locations. Finder.Find therefore tries the inherited PATH first and then a short list of well-known directories for the current OS. Runner runs a program as an argv, never through a shell.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("executable not found")
ErrNotFound is returned when a program is on neither the search path nor any of the well-known directories.
Functions ¶
This section is empty.
Types ¶
type Finder ¶
type Finder struct {
// Home is the user's home directory. Home-relative well-known directories are skipped
// when it is empty.
Home string
// Extra lists additional directories to search, before the well-known ones.
Extra []string
}
Finder resolves a program name to the absolute path of an executable.
type Runner ¶
type Runner struct {
Finder Finder
}
Runner runs programs as argv with exec.CommandContext. A name that is not an absolute path is resolved with Finder first.
func (Runner) Run ¶
func (r Runner) Run(ctx context.Context, name string, args ...string) (stdout, stderr []byte, err error)
Run runs name with args and returns what it wrote to stdout and stderr. The error is the lookup or exec error, wrapped; a non-zero exit is an *exec.ExitError in the chain, so callers can read its exit code.