summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2026-03-17 23:09:50 -0700
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2026-05-07 09:28:48 +0900
commitdea0cae04a436addd25e86cf94e2dd7975574dfa (patch)
treec7bf8f61023c787be4d3a86b7912717f0b039e23 /test
parentaa9d3a28a5ab4504d6a72dc65611e6f57080a070 (diff)
[ruby/io-wait] Fix race condition in TestIOWait#test_wait
Replace `sleep 0.1` with `IO.select([@r])` to reliably wait for data to arrive before asserting readability with a zero timeout. The fixed sleep was insufficient on slow Windows CI runners, causing sporadic failures. This matches the approach already used in test_wait_readable. https://github.com/ruby/io-wait/commit/dd32ec3682
Diffstat (limited to 'test')
-rw-r--r--test/io/wait/test_io_wait.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/io/wait/test_io_wait.rb b/test/io/wait/test_io_wait.rb
index ffe3b1f760..c532638e09 100644
--- a/test/io/wait/test_io_wait.rb
+++ b/test/io/wait/test_io_wait.rb
@@ -23,7 +23,7 @@ class TestIOWait < Test::Unit::TestCase
omit 'unstable on MinGW' if /mingw/ =~ RUBY_PLATFORM
assert_nil @r.wait(0)
@w.syswrite "."
- sleep 0.1
+ IO.select([@r])
assert_equal @r, @r.wait(0)
end