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.

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.