mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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_1@51607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
510bdd1502
commit
bd929bb48a
4 changed files with 32 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Mon Aug 17 17:12:46 2015 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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@ruby-lang.org>
|
Mon Aug 17 17:09:02 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* parse.y (lambda_body): pop cmdarg stack for lookahead
|
* parse.y (lambda_body): pop cmdarg stack for lookahead
|
||||||
|
|
|
@ -1263,6 +1263,29 @@ class TestProcess < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
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
|
def test_abort
|
||||||
with_tmpchdir do
|
with_tmpchdir do
|
||||||
s = run_in_child("abort")
|
s = run_in_child("abort")
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#define RUBY_VERSION "2.1.7"
|
#define RUBY_VERSION "2.1.7"
|
||||||
#define RUBY_RELEASE_DATE "2015-08-17"
|
#define RUBY_RELEASE_DATE "2015-08-17"
|
||||||
#define RUBY_PATCHLEVEL 389
|
#define RUBY_PATCHLEVEL 390
|
||||||
|
|
||||||
#define RUBY_RELEASE_YEAR 2015
|
#define RUBY_RELEASE_YEAR 2015
|
||||||
#define RUBY_RELEASE_MONTH 8
|
#define RUBY_RELEASE_MONTH 8
|
||||||
|
|
|
@ -4265,7 +4265,9 @@ waitpid(rb_pid_t pid, int *stat_loc, int options)
|
||||||
|
|
||||||
while (!(pid = poll_child_status(child, stat_loc))) {
|
while (!(pid = poll_child_status(child, stat_loc))) {
|
||||||
/* wait... */
|
/* 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 */
|
/* still active */
|
||||||
if (options & WNOHANG) {
|
if (options & WNOHANG) {
|
||||||
pid = 0;
|
pid = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue