fix(core): fixed disable telemetry function

A bit different from the mainline launcher
This commit is contained in:
Observer KRypt0n_ 2023-06-18 16:52:41 +02:00
parent 222a26400a
commit c26ce924d0
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2

View file

@ -20,24 +20,13 @@ pub fn disable_telemetry(sender: ComponentSender<App>) {
.collect::<Vec<String>>() .collect::<Vec<String>>()
.join("\\n"); .join("\\n");
let output = if config.patch.root { let output = Command::new("pkexec")
Command::new("pkexec")
.arg("echo") .arg("echo")
.arg("-e") .arg("-e")
.arg(format!("\\n{telemetry}\\n")) .arg(format!("\\n{telemetry}\\n"))
.arg(">>") .arg(">>")
.arg("/etc/hosts") .arg("/etc/hosts")
.spawn() .spawn();
}
else {
Command::new("echo")
.arg("-e")
.arg(format!("\\n{telemetry}\\n"))
.arg(">>")
.arg("/etc/hosts")
.spawn()
};
match output.and_then(|child| child.wait_with_output()) { match output.and_then(|child| child.wait_with_output()) {
Ok(output) => if !output.status.success() { Ok(output) => if !output.status.success() {