aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--win32/win32.c14
2 files changed, 19 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ee77b326b9..0b6f1d5461 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Dec 4 23:29:34 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (waitpid): fix bug of checking child slot.
+
+ * win32/win32.c (FindChildSlotByHandle): new.
+
Thu Dec 4 23:24:05 2008 Tanaka Akira <akr@fsij.org>
* lib/open3.rb (Open3.poutput3): new method.
diff --git a/win32/win32.c b/win32/win32.c
index f2129afac8..5829e86d68 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -533,6 +533,18 @@ FindChildSlot(rb_pid_t pid)
return NULL;
}
+static struct ChildRecord *
+FindChildSlotByHandle(HANDLE h)
+{
+
+ FOREACH_CHILD(child) {
+ if (child->hProcess == h) {
+ return child;
+ }
+ } END_FOREACH_CHILD;
+ return NULL;
+}
+
static void
CloseChildHandle(struct ChildRecord *child)
{
@@ -3062,7 +3074,7 @@ waitpid(rb_pid_t pid, int *stat_loc, int options)
return -1;
}
- return poll_child_status(ChildRecord + ret, stat_loc);
+ return poll_child_status(FindChildSlotByHandle(events[ret]), stat_loc);
}
else {
struct ChildRecord* child = FindChildSlot(pid);