summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-25 23:33:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-25 23:33:52 +0000
commit67fd07738d07ebe8c7a659ef40408240bfc34549 (patch)
treebb9edb5d78b2309fec83f9a557b98a45f3e38ea9 /test
parent65d3461e95246ba710a79ea8f6fcf145f872f304 (diff)
test/ruby/test_process.rb: get rid of timing issue
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_process.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index eb114dbebb..28a2f05a85 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -676,14 +676,17 @@ class TestProcess < Test::Unit::TestCase
return
end
IO.popen([RUBY, '-e', <<-'EOS']) {|io|
+ STDOUT.sync = true
trap(:USR1) { print "trap\n" }
+ puts "start"
system("cat", :in => "fifo")
EOS
- sleep 1
+ assert_equal("start\n", io.gets)
+ sleep 0.2 # wait for the child to stop at opening "fifo"
Process.kill(:USR1, io.pid)
- sleep 1
+ assert_equal("trap\n", io.readpartial(8))
File.write("fifo", "ok\n")
- assert_equal("trap\nok\n", io.read)
+ assert_equal("ok\n", io.read)
}
}
end unless windows? # does not support fifo