ruby-changes:39526
From: usa <ko1@a...>
Date: Mon, 17 Aug 2015 17:13:58 +0900 (JST)
Subject: [ruby-changes:39526] usa:r51607 (ruby_2_1): merge revision(s) 51202, 51203, 51204: [Backport #11340]
usa 2015-08-17 17:13:33 +0900 (Mon, 17 Aug 2015) New Revision: 51607 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51607 Log: 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] Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/test/ruby/test_process.rb branches/ruby_2_1/version.h branches/ruby_2_1/win32/win32.c Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 51606) +++ ruby_2_1/ChangeLog (revision 51607) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Mon Aug 17 17:12:46 2015 NAKAMURA Usaku <usa@r...> + + * win32/win32.c (waitpid): return immediately if interrupted. + reported by <takkanm AT gmail.com> [ruby-dev:49176] [Bug #11340] + Mon Aug 17 17:09:02 2015 Nobuyoshi Nakada <nobu@r...> * parse.y (lambda_body): pop cmdarg stack for lookahead Index: ruby_2_1/win32/win32.c =================================================================== --- ruby_2_1/win32/win32.c (revision 51606) +++ ruby_2_1/win32/win32.c (revision 51607) @@ -4265,7 +4265,9 @@ waitpid(rb_pid_t pid, int *stat_loc, int https://github.com/ruby/ruby/blob/trunk/ruby_2_1/win32/win32.c#L4265 while (!(pid = poll_child_status(child, stat_loc))) { /* wait... */ - if (rb_w32_wait_events_blocking(&child->hProcess, 1, timeout) != WAIT_OBJECT_0) { + int ret = rb_w32_wait_events_blocking(&child->hProcess, 1, timeout); + if (ret == WAIT_OBJECT_0 + 1) return -1; /* maybe EINTR */ + if (ret != WAIT_OBJECT_0) { /* still active */ if (options & WNOHANG) { pid = 0; Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 51606) +++ ruby_2_1/version.h (revision 51607) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.7" #define RUBY_RELEASE_DATE "2015-08-17" -#define RUBY_PATCHLEVEL 389 +#define RUBY_PATCHLEVEL 390 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_1/test/ruby/test_process.rb =================================================================== --- ruby_2_1/test/ruby/test_process.rb (revision 51606) +++ ruby_2_1/test/ruby/test_process.rb (revision 51607) @@ -1263,6 +1263,29 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_process.rb#L1263 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") Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r51202-51204 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/