Use 'sh -c' to properly execute 'echo' when disabling telemetry

This commit is contained in:
mkrsym1 2023-06-22 14:25:16 +03:00 committed by Observer KRypt0n_
parent 67ba65a3dc
commit 3ba2beb37d

View file

@ -22,20 +22,16 @@ pub fn disable_telemetry(sender: ComponentSender<App>) {
let output = if config.patch.root {
Command::new("pkexec")
.arg("echo")
.arg("-e")
.arg(format!("\\n{telemetry}\\n"))
.arg(">>")
.arg("/etc/hosts")
.arg("sh")
.arg("-c")
.arg(format!("echo \"\\n{telemetry}\\n\" >> /etc/hosts"))
.spawn()
}
else {
Command::new("echo")
.arg("-e")
.arg(format!("\\n{telemetry}\\n"))
.arg(">>")
.arg("/etc/hosts")
Command::new("sh")
.arg("-c")
.arg(format!("echo \"\\n{telemetry}\\n\" >> /etc/hosts"))
.spawn()
};