From 30f1c3c1b454fd77247d3caf068b1999b795d4de Mon Sep 17 00:00:00 2001 From: Xarblu Date: Wed, 12 Mar 2025 02:07:37 +0100 Subject: [PATCH] feat(sudo): add run0 as a sudo variant (#1067) --- src/sudo.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/sudo.rs b/src/sudo.rs index ae4d66fa..542b83cd 100644 --- a/src/sudo.rs +++ b/src/sudo.rs @@ -43,6 +43,7 @@ impl Sudo { .or_else(|| which("sudo").map(Self::determine_sudo_variant)) .or_else(|| which("gsudo").map(|p| (p, SudoKind::Gsudo))) .or_else(|| which("pkexec").map(|p| (p, SudoKind::Pkexec))) + .or_else(|| which("run0").map(|p| (p, SudoKind::Run0))) .or_else(|| which("please").map(|p| (p, SudoKind::Please))) .map(|(path, kind)| Self { path, kind }) } @@ -95,6 +96,13 @@ impl Sudo { // See: https://linux.die.net/man/1/pkexec cmd.arg("echo"); } + SudoKind::Run0 => { + // `run0` uses polkit for authentication + // and thus has the same issues as `pkexec`. + // + // See: https://www.freedesktop.org/software/systemd/man/devel/run0.html + cmd.arg("echo"); + } SudoKind::Please => { // From `man please` // -w, --warm @@ -131,6 +139,7 @@ pub enum SudoKind { Sudo, Gsudo, Pkexec, + Run0, Please, }