fixed utf8 parse error with lossy conversion
This commit is contained in:
parent
3faccc1b99
commit
3edf4aa95a
1 changed files with 1 additions and 16 deletions
|
@ -60,15 +60,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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<String> = vec![];
|
let mut drive_temps: Vec<String> = vec![];
|
||||||
|
|
||||||
|
@ -82,13 +73,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let tmp = match std::str::from_utf8(&output.stdout) {
|
let tmp = String::from_utf8_lossy(&output.stdout).into_owned();
|
||||||
Ok(val) => val,
|
|
||||||
Err(e) => {
|
|
||||||
println!("Error parsing hddtemp output: {}", e.to_string());
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
}.to_string();
|
|
||||||
|
|
||||||
if !tmp.contains("sensor") {
|
if !tmp.contains("sensor") {
|
||||||
drive_temps.push(tmp.replace("\n", "Not running as sudo?"));
|
drive_temps.push(tmp.replace("\n", "Not running as sudo?"));
|
||||||
|
|
Loading…
Reference in a new issue