From 3edf4aa95ac34de1e8bc66f63a4bcaee95bf241a Mon Sep 17 00:00:00 2001 From: Nickiel12 Date: Sat, 26 Aug 2023 07:35:03 -0700 Subject: [PATCH] fixed utf8 parse error with lossy conversion --- status_cloud/src/main.rs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/status_cloud/src/main.rs b/status_cloud/src/main.rs index 6614975..1a68b99 100644 --- a/status_cloud/src/main.rs +++ b/status_cloud/src/main.rs @@ -60,15 +60,6 @@ fn main() -> Result<(), Box> { } } - match Command::new(args.hddtemp_executable.clone()).output() { - Ok(val) => val, - Err(e) => { - println!("Error running hddtemp at all: {}", e.to_string()); - println!("hddtemp = {}", args.hddtemp_executable.clone()); - return Ok(()); - } - }; - { let mut drive_temps: Vec = vec![]; @@ -82,13 +73,7 @@ fn main() -> Result<(), Box> { } }; - let tmp = match std::str::from_utf8(&output.stdout) { - Ok(val) => val, - Err(e) => { - println!("Error parsing hddtemp output: {}", e.to_string()); - return Ok(()); - } - }.to_string(); + let tmp = String::from_utf8_lossy(&output.stdout).into_owned(); if !tmp.contains("sensor") { drive_temps.push(tmp.replace("\n", "Not running as sudo?"));