Skip to content

Commit bd929bb

Browse files
committed
merge revision(s) 51202,51203,51204: [Backport ruby#11340]
* win32/win32.c (waitpid): return immediately if interrupted. reported by <takkanm AT gmail.com> [ruby-dev:49176] [Bug ruby#11340] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@51607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 510bdd1 commit bd929bb

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Mon Aug 17 17:12:46 2015 NAKAMURA Usaku <[email protected]>
2+
3+
* win32/win32.c (waitpid): return immediately if interrupted.
4+
reported by <takkanm AT gmail.com> [ruby-dev:49176] [Bug #11340]
5+
16
Mon Aug 17 17:09:02 2015 Nobuyoshi Nakada <[email protected]>
27

38
* parse.y (lambda_body): pop cmdarg stack for lookahead

test/ruby/test_process.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,29 @@ def test_waitall
12631263
end
12641264
end
12651265

1266+
def test_wait_exception
1267+
bug11340 = '[ruby-dev:49176] [Bug #11340]'
1268+
t0 = t1 = nil
1269+
IO.popen([RUBY, '-e', 'puts;STDOUT.flush;Thread.start{gets;exit};sleep(3)'], 'r+') do |f|
1270+
pid = f.pid
1271+
f.gets
1272+
t0 = Time.now
1273+
th = Thread.start(Thread.current) do |main|
1274+
Thread.pass until main.stop?
1275+
main.raise Interrupt
1276+
end
1277+
begin
1278+
assert_raise(Interrupt) {Process.wait(pid)}
1279+
ensure
1280+
th.kill.join
1281+
end
1282+
t1 = Time.now
1283+
f.puts
1284+
end
1285+
assert_operator(t1 - t0, :<, 3,
1286+
->{"#{bug11340}: #{t1-t0} seconds to interrupt Process.wait"})
1287+
end
1288+
12661289
def test_abort
12671290
with_tmpchdir do
12681291
s = run_in_child("abort")

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.1.7"
22
#define RUBY_RELEASE_DATE "2015-08-17"
3-
#define RUBY_PATCHLEVEL 389
3+
#define RUBY_PATCHLEVEL 390
44

55
#define RUBY_RELEASE_YEAR 2015
66
#define RUBY_RELEASE_MONTH 8

win32/win32.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4265,7 +4265,9 @@ waitpid(rb_pid_t pid, int *stat_loc, int options)
42654265

42664266
while (!(pid = poll_child_status(child, stat_loc))) {
42674267
/* wait... */
4268-
if (rb_w32_wait_events_blocking(&child->hProcess, 1, timeout) != WAIT_OBJECT_0) {
4268+
int ret = rb_w32_wait_events_blocking(&child->hProcess, 1, timeout);
4269+
if (ret == WAIT_OBJECT_0 + 1) return -1; /* maybe EINTR */
4270+
if (ret != WAIT_OBJECT_0) {
42694271
/* still active */
42704272
if (options & WNOHANG) {
42714273
pid = 0;

0 commit comments

Comments
 (0)