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
This commit is contained in:
nobu 2017-12-25 23:33:52 +00:00
Родитель 65d3461e95
Коммит 67fd07738d
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -676,14 +676,17 @@ class TestProcess < Test::Unit::TestCase
return return
end end
IO.popen([RUBY, '-e', <<-'EOS']) {|io| IO.popen([RUBY, '-e', <<-'EOS']) {|io|
STDOUT.sync = true
trap(:USR1) { print "trap\n" } trap(:USR1) { print "trap\n" }
puts "start"
system("cat", :in => "fifo") system("cat", :in => "fifo")
EOS 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) Process.kill(:USR1, io.pid)
sleep 1 assert_equal("trap\n", io.readpartial(8))
File.write("fifo", "ok\n") 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 end unless windows? # does not support fifo