Merge pull request #2797 from AMS21/fix_2794

Fix system informations `cpu_brand` always being empty
This commit is contained in:
Héctor 2025-02-15 14:15:43 +01:00 committed by GitHub
commit d6848977bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 204 additions and 116 deletions

View file

@ -17,7 +17,11 @@ pub(crate) fn information(
let mut system = System::new_all();
system.refresh_all();
let cpu = system.global_cpu_info();
let cpu_brand = system
.cpus()
.first()
.map(|cpu| cpu.brand().to_string())
.unwrap_or_default();
let memory_used = sysinfo::get_current_pid()
.and_then(|pid| system.process(pid).ok_or("Process not found"))
@ -29,7 +33,7 @@ pub(crate) fn information(
system_kernel: System::kernel_version(),
system_version: System::long_os_version(),
system_short_version: System::os_version(),
cpu_brand: cpu.brand().into(),
cpu_brand,
cpu_cores: system.physical_core_count(),
memory_total: system.total_memory(),
memory_used,