shellenv

package
v1.54.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyToProcess

func ApplyToProcess() error

func CombinedOutputShellCommand

func CombinedOutputShellCommand(cmd *exec.Cmd) ([]byte, error)

CombinedOutputShellCommand is the process-tree-cleaning counterpart to cmd.CombinedOutput. It requires cmd.Stdout and cmd.Stderr to be unset, captures both streams, and delegates lifecycle cleanup to RunShellCommand.

func ConfigureShellCommand

func ConfigureShellCommand(cmd *exec.Cmd)

ConfigureShellCommand is a no-op on platforms that lack process groups (and a process-tree kill primitive). Context cancellation falls back to the exec.CommandContext default of terminating the direct child only.

func LoginShell

func LoginShell() string

func OutputShellCommand

func OutputShellCommand(cmd *exec.Cmd) ([]byte, error)

OutputShellCommand is the process-tree-cleaning counterpart to cmd.Output. It requires cmd.Stdout to be unset, captures stdout, and delegates lifecycle cleanup to RunShellCommand.

func Resolve

func Resolve() ([]string, error)

func RunShellCommand

func RunShellCommand(cmd *exec.Cmd) error

RunShellCommand starts cmd with StartShellCommand, waits for it, and terminates any surviving command-group descendants.

Use this instead of cmd.Run after ConfigureShellCommand so clean exits and ordinary errors get the same process-tree cleanup as context cancellation.

func SetProcessRecordDir

func SetProcessRecordDir(string) func()

SetProcessRecordDir is a no-op outside unix.

Windows commands are confined to a kill-on-close job object (see ConfigureShellCommand in shell_command_windows.go). The kernel tears the whole job down when the handle closes, including on abrupt process death, so there is no escaped-descendant class for a persisted record to recover.

func StartShellCommand

func StartShellCommand(cmd *exec.Cmd) error

StartShellCommand starts cmd on platforms without extra process-tree setup. It exists so call sites can use the same lifecycle helpers on every platform.

func SupportsInteractive

func SupportsInteractive(shell string) bool

func TerminateShellCommandGroup

func TerminateShellCommandGroup(cmd *exec.Cmd)

TerminateShellCommandGroup is a no-op on platforms without a process-tree kill primitive, mirroring ConfigureShellCommand. The reap-the-group-on-exit guarantee is best-effort and platform-gated.

func WellKnownBinDirs

func WellKnownBinDirs() []string

WellKnownBinDirs returns common binary install locations that should be on PATH for tools like Homebrew, user-local installs, and language package managers (Go, Rust). Non-existent directories are included unchanged because Go's exec.LookPath ignores missing PATH entries - filtering here would require filesystem access in resolution, which complicates testing without adding value for daemon launch.

func WellKnownBinDirsForHome

func WellKnownBinDirsForHome(home string) []string

Types

This section is empty.

Jump to

Keyboard shortcuts

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