Skip to main content

resolve_windows

Function resolve_windows 

Source
pub(crate) fn resolve_windows(
    env: &dyn Fn(&str) -> Option<OsString>,
    is_file: &dyn Fn(&Path) -> bool,
) -> Option<PathBuf>
Expand description

Windows search order, first hit wins:

  1. AGENTMUX_BASH, if it names an existing file.
  2. sh.exe on PATH — the case that already worked (srv started from Git Bash, or a PATH that includes a Git tool directory). Its directory is on PATH, so the tools it needs are too.
  3. The Git install that owns the git.exe on PATH → its bin\sh.exe. Covers a Git installed anywhere, as long as git itself works.
  4. Standard Git install roots (machine-wide and per-user) → bin\sh.exe.

Relative PATH entries are skipped: resolving . against srv’s cwd would let a directory’s contents choose the shell.

Platform-neutral (takes its environment and filesystem as parameters, and splits PATH on ; itself) so the order is unit-tested on every CI host.