added yet more logging

This commit is contained in:
Nickiel12 2023-08-25 22:11:49 -07:00
parent 6ef6ef6588
commit f88f190386

View file

@ -65,9 +65,21 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut drive_temps: Vec<String> = vec![]; let mut drive_temps: Vec<String> = vec![];
for drive in drives { for drive in drives {
let output = Command::new("hddtemp").arg(drive).output()?; let output = match Command::new("hddtemp").arg(drive).output() {
Ok(val) => val,
Err(e) => {
println!("Error running hddtemp: {}", e.to_string());
return Ok(());
}
};
let tmp = std::str::from_utf8(&output.stdout)?.to_string(); 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();
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?"));