bug: change heim io fn to not bail on any error

This commit is contained in:
ClementTsang 2020-09-03 03:18:18 -04:00
parent 105e9d27bb
commit 3843d63dbb

View File

@ -72,7 +72,7 @@ pub async fn get_heim_io_usage_list(
if get_physical {
let mut physical_counter_stream = heim::disk::io_counters_physical();
while let Some(io) = physical_counter_stream.next().await {
let io = io?;
if let Ok(io) = io {
let mount_point = io.device_name().to_str().unwrap_or("Name Unavailable");
io_hash.insert(
mount_point.to_string(),
@ -82,10 +82,11 @@ pub async fn get_heim_io_usage_list(
}),
);
}
}
} else {
let mut counter_stream = heim::disk::io_counters();
while let Some(io) = counter_stream.next().await {
let io = io?;
if let Ok(io) = io {
let mount_point = io.device_name().to_str().unwrap_or("Name Unavailable");
io_hash.insert(
mount_point.to_string(),
@ -96,6 +97,7 @@ pub async fn get_heim_io_usage_list(
);
}
}
}
Ok(Some(io_hash))
}