summaryrefslogtreecommitdiff
path: root/test/ruby/test_process.rb
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-16 00:06:09 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-16 00:06:09 +0000
commite03546fd4caa8e08783153933a29ccef725c4fb0 (patch)
tree2c2ea2fb91a851fac53adee5f9ec1f43a34cbd4c /test/ruby/test_process.rb
parentd910af94d51727e94e547ad4588876f9a741cf6b (diff)
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
Diffstat (limited to 'test/ruby/test_process.rb')
-rw-r--r--test/ruby/test_process.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index 5aad1d52fb..b314b7f38a 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -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