Documentation
¶
Overview ¶
Package shellcmd provides unified cross-platform shell resolution and command construction shared by capabilities (sh.exec / sh.checks) and background tasks (Manager.Start).
Index ¶
- func BuildCommand(ctx context.Context, name, cmdLine string) (*exec.Cmd, error)
- func BuildResolvedCommand(ctx context.Context, exe string, args []string, dialect, cmdLine string) *exec.Cmd
- func ConfigureCmdLine(cmd *exec.Cmd, dialect, exe, cmdLine string)
- func DefaultShellName() string
- func IsNotFound(err error) bool
- func IsWSLSystemBash(p string) bool
- func Resolve(name string) (exe string, args []string, dialect string, err error)
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCommand ¶
BuildCommand resolves shell `name` and builds an *exec.Cmd for `cmdLine`, using raw Win32 CmdLine for `cmd` on Windows so embedded double quotes are not mangled into `\"` by Go's argv escaper.
func BuildResolvedCommand ¶
func BuildResolvedCommand(ctx context.Context, exe string, args []string, dialect, cmdLine string) *exec.Cmd
BuildResolvedCommand constructs an *exec.Cmd from an already-resolved (exe, args, dialect) tuple.
func ConfigureCmdLine ¶
ConfigureCmdLine applies dialect-specific attributes (such as raw Win32 CmdLine for cmd.exe) while preserving any existing SysProcAttr flags (e.g. CreationFlags = CREATE_NEW_PROCESS_GROUP).
func DefaultShellName ¶
func DefaultShellName() string
DefaultShellName returns the default shell dialect for the current OS ("pwsh" | "cmd" | "sh").
func IsNotFound ¶
IsNotFound reports whether err indicates a valid shell dialect whose binary is missing on this host.
func IsWSLSystemBash ¶
IsWSLSystemBash reports whether p points to the Windows WSL bash.exe launcher (e.g. C:\Windows\System32\bash.exe), which executes inside a Linux distribution rather than on the Windows host.