Skip to content

Commit 31069b9

Browse files
committed
test: fix flaky test_env_arg_ignore_signal_valid_signals timing issue
The test was using a fixed 100ms delay after sending a signal, which was not sufficient on slower systems or under CI load. This caused the test to fail intermittently when the process hadn't exited yet. Changed to use a retry loop with 50 iterations of 10ms delays (total 500ms max wait time), which gives the process more time to handle the signal and exit while still being responsive. This fixes the flaky test failure on macOS CI.
1 parent a3cf37b commit 31069b9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/by-util/test_env.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ impl Target {
4848
.spawn()
4949
.expect("failed to send signal")
5050
.wait();
51-
self.child.delay(100);
51+
// Give the process time to handle the signal and exit
52+
// Use a longer delay with retries to handle slower systems
53+
for _ in 0..50 {
54+
self.child.delay(10);
55+
if !self.child.is_alive() {
56+
break;
57+
}
58+
}
5259
}
5360
fn is_alive(&mut self) -> bool {
5461
self.child.is_alive()

0 commit comments

Comments
 (0)