aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-08 14:09:30 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-08 14:09:30 +0000
commit2c5a5431f31a7609f61bf9387fc93fc6664e5e40 (patch)
treec3567046c0c8b8ebb5b998f428c56b8aaea787e0 /test/ruby
parent650900b9051d9b6454b6bf491bb73065bd53bfb6 (diff)
downloadruby-2c5a5431f31a7609f61bf9387fc93fc6664e5e40.tar.gz
io.c: no wait when killed
* io.c (rb_io_s_popen): do not wait the child process during being killed. [ruby-core:70671] [Bug #11510] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_process.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index 6828c50bf1..5dbac8e8e0 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -1715,6 +1715,30 @@ class TestProcess < Test::Unit::TestCase
}
end
+ def test_popen_exit
+ bug11510 = '[ruby-core:70671] [Bug #11510]'
+ pid = nil
+ opt = {timeout: 10, pgroup: true, stdout_filter: ->(s) {pid = s}}
+ assert_ruby_status(["-", RUBY], <<-'end;', bug11510, **opt)
+ RUBY = ARGV[0]
+ th = Thread.start {
+ Thread.current.abort_on_exception = true
+ IO.popen([RUBY, "-esleep 15", err: [:child, :out]]) {|f|
+ STDOUT.puts f.pid
+ STDOUT.flush
+ sleep(2)
+ }
+ }
+ sleep(0.001) until th.stop?
+ end;
+ assert_match(/\A\d+\Z/, pid)
+ ensure
+ if pid
+ pid = pid.to_i
+ [:TERM, :KILL].each {|sig| Process.kill(sig, pid) rescue break}
+ end
+ end
+
def test_execopts_new_pgroup
return unless windows?