From 2d653fe9ae292c89e698eb8b3d5e6fe88f923caa Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Sat, 29 Nov 2025 23:25:17 +0100 Subject: [PATCH] Fix empty Storage section by configuring stdio pipes Root cause: run_command_with_timeout() was calling cmd.spawn() without configuring stdout/stderr pipes. This caused command output to go to journald instead of being captured by wait_with_output(). The disk collector received empty output and failed silently. Solution: Configure stdout(Stdio::piped()) and stderr(Stdio::piped()) before spawning commands. This ensures wait_with_output() can properly capture command output. Fixes: Empty Storage section, lsblk output appearing in journald Bump version to v0.1.222 --- Cargo.lock | 6 +++--- agent/Cargo.toml | 2 +- agent/src/collectors/mod.rs | 5 +++++ dashboard/Cargo.toml | 2 +- shared/Cargo.toml | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 211ed04..7c8fc89 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cm-dashboard" -version = "0.1.220" +version = "0.1.221" dependencies = [ "anyhow", "chrono", @@ -301,7 +301,7 @@ dependencies = [ [[package]] name = "cm-dashboard-agent" -version = "0.1.220" +version = "0.1.221" dependencies = [ "anyhow", "async-trait", @@ -324,7 +324,7 @@ dependencies = [ [[package]] name = "cm-dashboard-shared" -version = "0.1.220" +version = "0.1.221" dependencies = [ "chrono", "serde", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 94cf520..00abef5 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-agent" -version = "0.1.221" +version = "0.1.222" edition = "2021" [dependencies] diff --git a/agent/src/collectors/mod.rs b/agent/src/collectors/mod.rs index 2f3027e..a87b745 100644 --- a/agent/src/collectors/mod.rs +++ b/agent/src/collectors/mod.rs @@ -18,8 +18,13 @@ pub use error::CollectorError; /// Properly kills the process if timeout is exceeded pub async fn run_command_with_timeout(mut cmd: tokio::process::Command, timeout_secs: u64) -> std::io::Result { use tokio::time::timeout; + use std::process::Stdio; let timeout_duration = Duration::from_secs(timeout_secs); + // Configure stdio to capture output + cmd.stdout(Stdio::piped()); + cmd.stderr(Stdio::piped()); + let child = cmd.spawn()?; let pid = child.id(); diff --git a/dashboard/Cargo.toml b/dashboard/Cargo.toml index 0606823..ce5b310 100644 --- a/dashboard/Cargo.toml +++ b/dashboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard" -version = "0.1.221" +version = "0.1.222" edition = "2021" [dependencies] diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 634eca6..de4d72e 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-shared" -version = "0.1.221" +version = "0.1.222" edition = "2021" [dependencies]