From 65dfe3dbe1326da759aa04648af3ffa7adfde722 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 15 Nov 2026 23:17:00 +0100 Subject: [PATCH] tail: keep the --pid test processes off the test runner's stdin The dummy "sh" inherited stdin, so on OpenBSD CI, where the job script is piped into sh, it read and ran the rest of the script (uucore tests, make, cargo clean) concurrently, randomly deleting the doctests' rlibs. Use sleep with a null stdin, and plain seconds as BSD sleep rejects "999d". --- tests/by-util/test_tail.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index 13e430e9e38..e6235ec197a 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -927,8 +927,13 @@ fn test_follow_with_pid() { let (at, mut ucmd) = at_and_ucmd!(); - let dummy_cmd = "sh"; - let mut dummy = Command::new(dummy_cmd).spawn().unwrap(); + // A process that just waits; with stdin detached, so it can't read from + // whatever feeds the test runner (on CI, the rest of the job script). + let mut dummy = Command::new("sleep") + .arg("100000") + .stdin(Stdio::null()) + .spawn() + .unwrap(); let pid = dummy.id(); let mut child = ucmd @@ -5426,9 +5431,11 @@ fn test_following_with_pid() { let ts = TestScenario::new(util_name!()); + // Plain seconds: a "d" suffix is a GNU extension the BSD sleep rejects. #[cfg(not(windows))] let mut sleep_command = Command::new("sleep") - .arg("999d") + .arg("100000") + .stdin(Stdio::null()) .spawn() .expect("failed to start sleep command"); #[cfg(windows)]