mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-16 19:56:50 +08:00
chore: replace sudo with pkexec execution
This commit is contained in:
parent
90091db3b1
commit
babf5d840c
|
@ -103,7 +103,6 @@ pub async fn reinstall_service() -> Result<()> {
|
||||||
};
|
};
|
||||||
log::info!(target:"app", "status code:{}", status.code().unwrap());
|
log::info!(target:"app", "status code:{}", status.code().unwrap());
|
||||||
|
|
||||||
let elevator = crate::utils::help::linux_elevator();
|
|
||||||
let status = match get_effective_uid() {
|
let status = match get_effective_uid() {
|
||||||
0 => StdCommand::new(install_shell).status()?,
|
0 => StdCommand::new(install_shell).status()?,
|
||||||
_ => StdCommand::new(elevator)
|
_ => StdCommand::new(elevator)
|
||||||
|
|
|
@ -108,7 +108,7 @@ pub fn open_file(app: tauri::AppHandle, path: PathBuf) -> Result<()> {
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
pub fn linux_elevator() -> String {
|
pub fn linux_elevator() -> String {
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
match Command::new("which").arg("sudo").output() {
|
match Command::new("which").arg("pkexec").output() {
|
||||||
Ok(output) => {
|
Ok(output) => {
|
||||||
if !output.stdout.is_empty() {
|
if !output.stdout.is_empty() {
|
||||||
// Convert the output to a string slice
|
// Convert the output to a string slice
|
||||||
|
|
Loading…
Reference in New Issue
Block a user