[前][次][番号順一覧][スレッド一覧]

ruby-changes:19113

From: arton <ko1@a...>
Date: Wed, 23 Mar 2011 00:05:45 +0900 (JST)
Subject: [ruby-changes:19113] Ruby:r31152 (trunk): * win32/win32.c: wait process real termination after reading

arton	2011-03-23 00:05:39 +0900 (Wed, 23 Mar 2011)

  New Revision: 31152

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31152

  Log:
    * win32/win32.c: wait process real termination after reading 
      exit code. fixes #4518

  Modified files:
    trunk/ChangeLog
    trunk/win32/win32.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 31151)
+++ ChangeLog	(revision 31152)
@@ -1,3 +1,8 @@
+Wed Mar 23 00:12:16 2011  Tajima Akio <artonx@y...>
+
+	* win32/win32.c: wait process real termination after reading 
+	  exit code. fixes #4518
+
 Tue Mar 22 21:20:10 2011  NARUSE, Yui  <naruse@r...>
 
 	* lib/rubygems/test_case.rb: save current dir to @current_dir
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 31151)
+++ win32/win32.c	(revision 31152)
@@ -3549,6 +3549,7 @@
 
     if (!GetExitCodeProcess(child->hProcess, &exitcode)) {
 	/* If an error occured, return immediatly. */
+    error_exit:
 	err = GetLastError();
 	if (err == ERROR_INVALID_PARAMETER)
 	    errno = ECHILD;
@@ -3562,7 +3563,12 @@
 	return -1;
     }
     if (exitcode != STILL_ACTIVE) {
-	/* If already died, return immediatly. */
+        rb_pid_t pid;
+	/* If already died, wait process's real termination. */
+        if (rb_w32_wait_events_blocking(&child->hProcess, 1, INFINITE) != WAIT_OBJECT_0) {
+	    goto error_exit;
+        }
+	pid = child->pid;
 	rb_pid_t pid = child->pid;
 	CloseChildHandle(child);
 	if (stat_loc) *stat_loc = exitcode << 8;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]