From 156b1f331f1804207cce19978b8a99b49067ea15 Mon Sep 17 00:00:00 2001 From: Argenis Date: Sat, 21 Mar 2026 12:19:53 -0400 Subject: [PATCH] fix(hardware): drain stdin in subprocess test to prevent broken pipe flake (#4161) * fix(hardware): drain stdin in subprocess test to prevent broken pipe flake The test script did not consume stdin, so SubprocessTool's stdin write raced against the process exit, causing intermittent EPIPE failures. Add `cat > /dev/null` to drain stdin before producing output. * style: format subprocess test --- src/hardware/subprocess.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hardware/subprocess.rs b/src/hardware/subprocess.rs index d3b702719..fd603a778 100644 --- a/src/hardware/subprocess.rs +++ b/src/hardware/subprocess.rs @@ -407,7 +407,11 @@ mod tests { // Simpler: write a temp script. let dir = tempfile::tempdir().unwrap(); let script_path = dir.path().join("tool.sh"); - std::fs::write(&script_path, format!("#!/bin/sh\necho '{}'\n", result_json)).unwrap(); + std::fs::write( + &script_path, + format!("#!/bin/sh\ncat > /dev/null\necho '{}'\n", result_json), + ) + .unwrap(); #[cfg(unix)] { use std::os::unix::fs::PermissionsExt;