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![];
|
||||
|
||||
|
@ -82,13 +73,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
}
|
||||
};
|
||||
|
||||
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?"));
|
||||
|
|
Loading…
Reference in a new issue