1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test/ruby/test_process.rb: avoid killing wrong parent

We must capture intended target PID before forking, since
Process.ppid may change if parent dies (e.g. due to timeout)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2014-10-16 00:06:09 +00:00
parent d910af94d5
commit e03546fd4c
2 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Thu Oct 16 08:58:11 2014 Eric Wong <e@80x24.org>
* test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):
avoid killing wrong parent
Thu Oct 16 08:40:04 2014 Eric Wong <e@80x24.org>
* cont.c (fiber_store): restore references to next_fib (fix typo)

View file

@ -1925,8 +1925,9 @@ EOS
begin
$stderr.reopen($stdout)
trap(:QUIT) {}
parent = $$
100.times do |i|
pid = fork {Process.kill(:QUIT, Process.ppid)}
pid = fork {Process.kill(:QUIT, parent)}
IO.popen(ruby, 'r+'){}
Process.wait(pid)
$stdout.puts