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:
parent
56f2d0aa98
commit
e1aec4aed8
2 changed files with 14 additions and 3 deletions
|
@ -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>
|
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
|
* thread.c (thread_start_func_2): store the result of first_func
|
||||||
|
|
12
process.c
12
process.c
|
@ -1343,10 +1343,16 @@ rb_fork(int *status, int (*chfunc)(void*), void *charg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __VMS
|
#ifndef __VMS
|
||||||
rb_io_flush(rb_stdout);
|
#define prefork() ( \
|
||||||
rb_io_flush(rb_stderr);
|
rb_io_flush(rb_stdout), \
|
||||||
|
rb_io_flush(rb_stderr) \
|
||||||
|
)
|
||||||
|
#else
|
||||||
|
#define prefork() ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
prefork();
|
||||||
|
|
||||||
#ifdef FD_CLOEXEC
|
#ifdef FD_CLOEXEC
|
||||||
if (chfunc) {
|
if (chfunc) {
|
||||||
if (pipe(ep)) return -1;
|
if (pipe(ep)) return -1;
|
||||||
|
@ -1356,7 +1362,7 @@ rb_fork(int *status, int (*chfunc)(void*), void *charg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
while ((pid = fork()) < 0) {
|
for (; (pid = fork()) < 0; prefork()) {
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
case EAGAIN:
|
case EAGAIN:
|
||||||
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
|
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
|
||||||
|
|
Loading…
Add table
Reference in a new issue