From 88d98517c8843d174973389f28c7f4aed2bc7ad7 Mon Sep 17 00:00:00 2001 From: MystiPanda Date: Wed, 24 Jul 2024 14:22:23 +0800 Subject: [PATCH] fix: wrap the password in quotes #1460 --- src-tauri/src/core/service.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/src/core/service.rs b/src-tauri/src/core/service.rs index 800786d..3a06648 100644 --- a/src-tauri/src/core/service.rs +++ b/src-tauri/src/core/service.rs @@ -30,7 +30,7 @@ pub struct JsonResponse { #[cfg(not(target_os = "windows"))] pub fn sudo(passwd: &String, cmd: String) -> StdCommand { - let shell = format!("echo {} | sudo -S {}", passwd, cmd); + let shell = format!("echo \"{}\" | sudo -S {}", passwd, cmd); let mut command = StdCommand::new("bash"); command.arg("-c").arg(shell); command