Преглед изворни кода

fix: wrap the password in quotes

#1460
MystiPanda пре 10 месеци
родитељ
комит
88d98517c8
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      src-tauri/src/core/service.rs

+ 1 - 1
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