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

* process.c (rb_fork): flush stdouts always before fork(2).

fixed: [ruby-dev:30612]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-03-20 00:12:51 +00:00
parent 56f2d0aa98
commit e1aec4aed8
2 changed files with 14 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Tue Mar 20 09:13:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* process.c (rb_fork): flush stdouts always before fork(2).
fixed: [ruby-dev:30612]
Tue Mar 20 01:38:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* thread.c (thread_start_func_2): store the result of first_func

View file

@ -1343,10 +1343,16 @@ rb_fork(int *status, int (*chfunc)(void*), void *charg)
#endif
#ifndef __VMS
rb_io_flush(rb_stdout);
rb_io_flush(rb_stderr);
#define prefork() ( \
rb_io_flush(rb_stdout), \
rb_io_flush(rb_stderr) \
)
#else
#define prefork() ((void)0)
#endif
prefork();
#ifdef FD_CLOEXEC
if (chfunc) {
if (pipe(ep)) return -1;
@ -1356,7 +1362,7 @@ rb_fork(int *status, int (*chfunc)(void*), void *charg)
}
}
#endif
while ((pid = fork()) < 0) {
for (; (pid = fork()) < 0; prefork()) {
switch (errno) {
case EAGAIN:
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN