diff options
Diffstat (limited to 'process.c')
| -rw-r--r-- | process.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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 |
