Skip to main content

resolve_privilege_tool

Function resolve_privilege_tool 

Source
pub fn resolve_privilege_tool(
    mode: PrivilegeMode,
) -> Result<PrivilegeTool, String>
Expand description

What: Resolve which privilege tool to use based on the configured mode.

Inputs:

Output: Ok(tool) on success, Err with actionable message on failure.

ยงErrors

  • Auto: neither doas nor sudo found on $PATH.
  • Sudo/Doas: the explicitly requested tool is not on $PATH.

Details:

  • Auto prefers doas over sudo when both are available.
  • Explicit modes fail fast with a message suggesting config changes.