diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app/data_harvester.rs | 22 | ||||
-rw-r--r-- | src/bin/main.rs | 10 |
2 files changed, 25 insertions, 7 deletions
diff --git a/src/app/data_harvester.rs b/src/app/data_harvester.rs index f15c0fcb..08f184d1 100644 --- a/src/app/data_harvester.rs +++ b/src/app/data_harvester.rs @@ -251,14 +251,22 @@ impl DataCollector { if self.widgets_to_harvest.use_temp { self.sys.refresh_components(); } - if cfg!(target_os = "windows") && self.widgets_to_harvest.use_net { - self.sys.refresh_networks(); - } - if cfg!(target_os = "freebsd") && self.widgets_to_harvest.use_disk { - self.sys.refresh_disks(); + + #[cfg(target_os = "windows")] + { + if self.widgets_to_harvest.use_net { + self.sys.refresh_networks(); + } } - if cfg!(target_os = "freebsd") && self.widgets_to_harvest.use_mem { - self.sys.refresh_memory(); + + #[cfg(target_os = "freebsd")] + { + if self.widgets_to_harvest.use_disk { + self.sys.refresh_disks(); + } + if self.widgets_to_harvest.use_mem { + self.sys.refresh_memory(); + } } } diff --git a/src/bin/main.rs b/src/bin/main.rs index ae6cce84..7168900b 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -131,6 +131,16 @@ fn main() -> Result<()> { terminal.clear()?; terminal.hide_cursor()?; + #[cfg(target_os = "freebsd")] + let _stderr_fd = { + // A really ugly band-aid to suppress stderr warnings on FreeBSD due to sysinfo. + use filedescriptor::{FileDescriptor, StdioDescriptor}; + use std::fs::OpenOptions; + + let path = OpenOptions::new().write(true).open("/dev/null")?; + FileDescriptor::redirect_stdio(&path, StdioDescriptor::Stderr)? + }; + // Set panic hook panic::set_hook(Box::new(panic_hook)); |