Skip to content

Commit

Permalink
Merge pull request #1249 from GuillaumeGomez/backport
Browse files Browse the repository at this point in the history
Backport #1248 and #1246 to 0.30
  • Loading branch information
GuillaumeGomez committed Apr 10, 2024
2 parents 93f9b82 + 053a7b4 commit be83c6a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/unix/linux/component.rs
Expand Up @@ -374,16 +374,15 @@ impl ComponentsInner {
continue;
};
let entry = entry.path();
if !file_type.is_dir()
|| !entry
if !file_type.is_file()
&& entry
.file_name()
.and_then(|x| x.to_str())
.unwrap_or("")
.starts_with("hwmon")
{
continue;
ComponentInner::from_hwmon(&mut self.components, &entry);
}
ComponentInner::from_hwmon(&mut self.components, &entry);
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions tests/components.rs
@@ -0,0 +1,17 @@
// Take a look at the license at the top of the repository in the LICENSE file.

#[test]
fn test_components() {
use std::env::var;

let mut c = sysinfo::Components::new();
assert!(c.is_empty());

// Unfortunately, we can't get components in the CI...
if !sysinfo::IS_SUPPORTED_SYSTEM || cfg!(windows) || var("CI").is_ok() {
return;
}

c.refresh_list();
assert!(!c.is_empty());
}

0 comments on commit be83c6a

Please sign in to comment.