pub enum HostShell {
Posix,
PowerShell,
}Expand description
Which shell execute_command hands model commands to on this host.
THE single answer to “what interpreter runs shell commands?”: the exec
tool’s spawn (shell_invocation), risk classification
(classify_command_for), the plan-mode carve-outs
(is_plan_safe_build_command, is_plan_file_only_write), and the
transcript label (display_info_for) all key on this one value, so they
cannot drift apart again — classifying (or labeling) for a different
interpreter than the one that executes is exactly the bug family that
made plan mode deny every read-only PowerShell pipeline on Windows while
the transcript wrapped those pipelines in Bash(...).
Windows executes under PowerShell (pwsh when installed, Windows
PowerShell 5.1 otherwise); everywhere else sh. Self::current is the
only cfg! site for the decision.
Variants§
Implementations§
Source§impl HostShell
impl HostShell
Sourcepub const fn display_name(self) -> &'static str
pub const fn display_name(self) -> &'static str
Transcript label for an execute_command row (Bash(cargo test),
PowerShell(Get-ChildItem)). “Bash” is the colloquial POSIX label —
the interpreter is sh — kept for familiarity.
Sourcepub const fn prompt_sigil(self) -> &'static str
pub const fn prompt_sigil(self) -> &'static str
Prompt sigil an approval modal puts in front of a command so it reads
as one. Dialect-specific for the same reason the label is: $ in
front of Get-ChildItem tells the reader they are approving a POSIX
shell command, which is not what will run.