feat: Service Mode for Linux (#804)

This commit is contained in:
HZ is not Chatty
2024-03-31 16:16:23 +08:00
committed by GitHub
parent c5d7c29f3d
commit 3b06cf8a2a
12 changed files with 180 additions and 29 deletions

View File

@@ -0,0 +1,15 @@
use std::process::Command;
#[cfg(target_os = "linux")]
pub fn linux_elevator() -> &'static str {
match Command::new("which").arg("pkexec").output() {
Ok(output) => {
if output.stdout.is_empty() {
"sudo"
} else {
"pkexec"
}
}
Err(_) => "sudo",
}
}