[Bug #672] rb_io_flush in pipe_open


#1

Bug #672: rb_io_flush in pipe_open
http://redmine.ruby-lang.org/issues/show/672

e$B5/I<<Te(B: Kazuhiro NISHIYAMA
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
e$B%+%F%4%je(B: core

e$BD>8e$Ne(Brb_forke$B$NCf$Ge(B
#define prefork() (
rb_io_flush(rb_stdout),
rb_io_flush(rb_stderr)
)
prefork();
e$B$H$7$F$$$k$N$G!"e(Bpipe_opene$B$Ne(Brb_io_flushe$B$OITMW$J$N$G$O$J$$$G$7$g$&$+e(B?

Index: io.c

— io.c (revision 19868)
+++ io.c (working copy)
@@ -4445,8 +4445,6 @@ pipe_open(struct rb_exec_arg eargp, VAL
}
else {
fflush(stdin); /
is it really needed? */

  • rb_io_flush(rb_stdout);
  • rb_io_flush(rb_stderr);
    pid = rb_fork(&status, 0, 0, Qnil);
    if (pid == 0) { /* child */
    popen_redirect(&arg);

#2

e$B%A%1%C%He(B #672 e$B$,99?7$5$l$^$7$?!#e(B (by Yukihiro M.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r19888.

http://redmine.ruby-lang.org/issues/show/672