pub fn run_interactive_auth(tool: PrivilegeTool) -> Result<bool, String>Expand description
What: Run the privilege tool interactively to let the user authenticate.
Inputs:
tool: Resolved privilege tool (sudo or doas).
Output:
Ok(true)if authentication succeeded,Ok(false)if it failed.
§Errors
Returns Err if the tool binary cannot be executed.
Details:
- For sudo: runs
sudo -vwhich validates credentials without executing a command. On success, the credential cache is refreshed so subsequentsudocalls don’t re-prompt. - For doas: runs
doas true(a no-op command) to trigger authentication. Ifpersistis configured indoas.conf, subsequentdoascalls won’t re-prompt. Withoutpersist, eachdoasinvocation will re-prompt (known limitation). - The caller is responsible for ensuring the terminal is in a state where the user can interact with the prompt (e.g. not in TUI raw mode).