Skip to main content

Module executable

Module executable 

Source
Expand description

Portable executable discovery.

Winx used to probe for programs with sh -c 'command -v …', which assumes a POSIX shell on PATH. Native Windows has no sh, and its bash.exe may be the WSL launcher in System32 rather than a usable shell, so lookups are done directly against PATH (honoring PATHEXT on Windows) and the known Git for Windows install locations.

Enums§

ShellKind
Shell family Winx drives in the PTY. It decides the prompt bootstrap, the completion marker, and which statement policy applies to commands.

Functions§

bash_executable
The bash executable Winx should drive. On Unix this is whatever PATH resolves. On Windows the Git for Windows shell is preferred and System32\bash.exe (the WSL launcher, which needs a distribution and does not honor PROMPT_COMMAND) is never selected.
find_on_path
Locate program on PATH. A name with a path separator is checked as-is. On Windows, a bare name is tried with every PATHEXT suffix (.exe, .cmd, …) as well as verbatim.
is_available
Whether program can be found on PATH. Best-effort: used for advisory hints and shell selection, never as a security boundary.
powershell_executable
PowerShell to drive when requested (or when Windows has no Git for Windows bash). PowerShell 7 (pwsh) is preferred; Windows PowerShell 5.1 is the fallback on Windows only.
shell_kind_of
Classify a shell selection (zsh, /bin/zsh, pwsh, C:\\...\\pwsh.exe, powershell) by its basename; anything unrecognized is driven as bash.