summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-12 14:55:00 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-12 14:55:00 +0000
commit388215e32396b1a67bab2849951f48ffc68dfb19 (patch)
tree9b0def0ce8951302c2b23f0bdadfacdd3cf7dc0c /test
parent3a78ff203c628b9a5a9edb2794e2910600cff723 (diff)
merge revision(s) 51202,51203,51204: [Backport #11340]
* win32/win32.c (waitpid): return immediately if interrupted. reported by <takkanm AT gmail.com> [ruby-dev:49176] [Bug #11340] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_process.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index f1fd2c25dc..8847f6b917 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -1299,6 +1299,29 @@ class TestProcess < Test::Unit::TestCase
end
end
+ def test_wait_exception
+ bug11340 = '[ruby-dev:49176] [Bug #11340]'
+ t0 = t1 = nil
+ IO.popen([RUBY, '-e', 'puts;STDOUT.flush;Thread.start{gets;exit};sleep(3)'], 'r+') do |f|
+ pid = f.pid
+ f.gets
+ t0 = Time.now
+ th = Thread.start(Thread.current) do |main|
+ Thread.pass until main.stop?
+ main.raise Interrupt
+ end
+ begin
+ assert_raise(Interrupt) {Process.wait(pid)}
+ ensure
+ th.kill.join
+ end
+ t1 = Time.now
+ f.puts
+ end
+ assert_operator(t1 - t0, :<, 3,
+ ->{"#{bug11340}: #{t1-t0} seconds to interrupt Process.wait"})
+ end
+
def test_abort
with_tmpchdir do
s = run_in_child("abort")