From 70a150152cb6ada7ec74b75eaf16af46bb71e48d Mon Sep 17 00:00:00 2001 From: jasonwitty Date: Mon, 6 Oct 2025 09:51:11 -0700 Subject: [PATCH] fix for windows build error --- socktop_agent/src/metrics.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/socktop_agent/src/metrics.rs b/socktop_agent/src/metrics.rs index a4bd9e8..c818e7c 100644 --- a/socktop_agent/src/metrics.rs +++ b/socktop_agent/src/metrics.rs @@ -1006,7 +1006,7 @@ pub async fn collect_process_metrics( // Fallback if /proc read fails (permission issue) (0, 0) }; - + #[cfg(not(target_os = "linux"))] let (user_id, group_id) = (0, 0); @@ -1029,13 +1029,23 @@ pub async fn collect_process_metrics( (Some(rchar), Some(wchar)) } else { - // Fallback to sysinfo if we can't read /proc (permissions, non-Linux, etc.) + // Fallback to sysinfo if we can't read /proc (permissions) let disk_usage = process.disk_usage(); ( Some(disk_usage.total_read_bytes), Some(disk_usage.total_written_bytes), ) }; + + #[cfg(not(target_os = "linux"))] + let (read_bytes, write_bytes) = { + let disk_usage = process.disk_usage(); + ( + Some(disk_usage.total_read_bytes), + Some(disk_usage.total_written_bytes), + ) + }; + let working_directory = process.cwd().map(|p| p.to_string_lossy().to_string()); let executable_path = process.exe().map(|p| p.to_string_lossy().to_string());