From d41d74d0f829febb8851ade15b712e5b1cd101eb Mon Sep 17 00:00:00 2001 From: huzibaca Date: Mon, 21 Oct 2024 02:31:43 +0800 Subject: [PATCH] chore: replace sudo with pkexec execution --- src-tauri/src/core/service.rs | 1 - src-tauri/src/utils/help.rs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src-tauri/src/core/service.rs b/src-tauri/src/core/service.rs index f20d665b..07853b28 100644 --- a/src-tauri/src/core/service.rs +++ b/src-tauri/src/core/service.rs @@ -103,7 +103,6 @@ pub async fn reinstall_service() -> Result<()> { }; log::info!(target:"app", "status code:{}", status.code().unwrap()); - let elevator = crate::utils::help::linux_elevator(); let status = match get_effective_uid() { 0 => StdCommand::new(install_shell).status()?, _ => StdCommand::new(elevator) diff --git a/src-tauri/src/utils/help.rs b/src-tauri/src/utils/help.rs index b6fda2a9..35279187 100644 --- a/src-tauri/src/utils/help.rs +++ b/src-tauri/src/utils/help.rs @@ -108,7 +108,7 @@ pub fn open_file(app: tauri::AppHandle, path: PathBuf) -> Result<()> { #[cfg(target_os = "linux")] pub fn linux_elevator() -> String { use std::process::Command; - match Command::new("which").arg("sudo").output() { + match Command::new("which").arg("pkexec").output() { Ok(output) => { if !output.stdout.is_empty() { // Convert the output to a string slice