mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 19:23:47 +08:00
15 lines
351 B
Rust
15 lines
351 B
Rust
#[cfg(target_os = "linux")]
|
|
pub fn linux_elevator() -> &'static str {
|
|
use std::process::Command;
|
|
match Command::new("which").arg("pkexec").output() {
|
|
Ok(output) => {
|
|
if output.stdout.is_empty() {
|
|
"sudo"
|
|
} else {
|
|
"pkexec"
|
|
}
|
|
}
|
|
Err(_) => "sudo",
|
|
}
|
|
}
|