Skip to main content

run_sudo_with

Function run_sudo_with 

Source
pub fn run_sudo_with(
    name: &str,
    args: &[String],
    geteuid: impl Fn() -> u32,
    look_path: impl Fn(&str) -> Result<PathBuf, ExecError>,
) -> Result<(), ExecError>
Expand description

Ported from runSudo. See apply_sudo_with’s doc comment: this port takes the euid getter and PATH lookup as explicit parameters (rather than Go’s reassignable package-level vars) so tests can stub them without touching real root privileges or the real sudo binary. Runs synchronously with inherited stdio (std::process::Command), matching Go’s runSudo, which deliberately does not capture output so sudo can prompt on the controlling terminal.