pub fn shell_program_override(
shell: &str,
lookup: impl Fn(&str) -> Option<String>,
) -> Option<String>Expand description
The shell program to run in place of shell, if one was configured.
None means run shell as before. The value is a program path or a name to look up on
PATH — not a command line: shells on Windows live at paths like
C:\Program Files\Git\bin\bash.exe, and treating the value as a command line would make
usage responsible for quoting rules it has no reason to own. Command passes the program
and each argument separately, so a path with spaces needs no quoting.
An empty or blank value reads as unset, matching the FOO= cmd convention for switching
something off. Nothing checks that the program exists: the value need not be an absolute
path, so deciding would mean reimplementing PATH, PATHEXT and permission lookup, and
racing the spawn that follows. A bad value surfaces as a spawn error naming it.
lookup is injected rather than read from the environment so this stays testable without
mutating process-wide state — the same shape as parse_partial_with_env in usage-lib.