Skip to main content

root_command

Function root_command 

Source
pub fn root_command<S: AsRef<OsStr>>(
    argv: &[S],
    interactive: bool,
) -> Result<RootCommand, EscalationError>
Expand description

Build the invocation that runs argv as root.

interactive should be true only when a controlling terminal is attached (see run_as_root, which detects it). With a terminal we prefer an inline sudo -E prompt; without one we use the platform’s graphical escalator.

Fails only on Linux when there is no terminal and neither pkexec nor a graphical askpass for sudo -A is available.