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
This commit is contained in:
Argenis 2026-03-21 12:19:53 -04:00 committed by Roman Tataurov
parent 9ff96c63dd
commit 156b1f331f
No known key found for this signature in database
GPG Key ID: 70A51EF3185C334B

View File

@ -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;