1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* win32/win32.c: wait process real termination after reading

exit code. fixes #4518


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
arton 2011-03-22 15:05:39 +00:00
parent f06ec31c54
commit 50ff6ed866
2 changed files with 12 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Wed Mar 23 00:12:16 2011 Tajima Akio <artonx@yahoo.co.jp>
* win32/win32.c: wait process real termination after reading
exit code. fixes #4518
Tue Mar 22 21:20:10 2011 NARUSE, Yui <naruse@ruby-lang.org>
* lib/rubygems/test_case.rb: save current dir to @current_dir

View file

@ -3549,6 +3549,7 @@ poll_child_status(struct ChildRecord *child, int *stat_loc)
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 @@ poll_child_status(struct ChildRecord *child, int *stat_loc)
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;