From 4983a3c0bab02badfc8220bc01569c6c872aabb6 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Sun, 17 Nov 2024 20:28:51 +0100 Subject: [PATCH] api: disk list: do not fail but just log error on gathering smart data I plugged in a USB pen drive and the whole disk list UI became completely unusable because smartctl fails to handle that device due to some `Unknown USB bridge [0x090c:0x1000 (0x1100)]` error. That itself might be improvable, but most often I do not care at all about smart data, and certainly not enough to make failing gathering it disallow me from viewing my disks (or the smart data from disks where it still could be gathered, for that matter!) Signed-off-by: Thomas Lamprecht --- src/tools/disks/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tools/disks/mod.rs b/src/tools/disks/mod.rs index 9f47be36..6345fde7 100644 --- a/src/tools/disks/mod.rs +++ b/src/tools/disks/mod.rs @@ -1083,8 +1083,11 @@ fn get_disks( let parallel_handler = ParallelHandler::new("smartctl data", 4, move |device: (String, String)| { - let smart_data = get_smart_data(Path::new(&device.1), false)?; - tx.send((device.0, smart_data))?; + match get_smart_data(Path::new(&device.1), false) { + Ok(smart_data) => tx.send((device.0, smart_data))?, + // do not fail the whole disk output just because smartctl couldn't query one + Err(err) => log::error!("failed to gather smart data for {} – {err}", device.1), + } Ok(()) });