hostbin

package
v1.34.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package hostbin resolves host binaries that live outside the PATH a daemon inherits. lerd-ui and lerd-watcher are started by launchd (or systemd), which hands them a minimal PATH — on macOS literally /usr/bin:/bin:/usr/sbin:/sbin — so a tool the user installed with Homebrew is invisible to exec.LookPath even though it works fine in their terminal. Anything a daemon may have to run goes through here so the CLI and the daemons resolve the same binary.

Index

Constants

This section is empty.

Variables

View Source
var ExtraDirs = func() []string {

	dirs := []string{config.BinDir()}
	if runtime.GOOS == "darwin" {
		return append(dirs, "/opt/homebrew/bin", "/usr/local/bin")
	}
	return append(dirs, "/usr/local/bin", "/snap/bin", "/home/linuxbrew/.linuxbrew/bin")
}

ExtraDirs lists the install prefixes a daemon's PATH leaves out: lerd's own bin dir, both Homebrew prefixes on macOS (Apple Silicon and Intel), and the equivalents on Linux. Ordered the way a login shell would see them. A var so tests can point it at a fixture instead of depending on what the host has installed.

Functions

func Look

func Look(name string) (string, bool)

Look resolves name to an absolute path: PATH first, then the extra dirs. Reports false when the binary is nowhere to be found.

func Path

func Path(name string) string

Path is Look for callers building a command line: it returns the resolved absolute path, or the bare name so the failure surfaces as the OS's own "executable file not found" rather than as a silent substitution.

Types

This section is empty.

Jump to

Keyboard shortcuts

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