# \[Bug #672\] rb\_io\_flush in pipe\_open

**URL:** <https://www.ruby-forum.com/t/bug-672-rb-io-flush-in-pipe-open/151428>\
**Category:** Development\
**Created:** [October 21, 2008, 11:13am UTC](https://www.ruby-forum.com/t/bug-672-rb-io-flush-in-pipe-open/151428 "2008-10-21T11:13:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/77aa72/32.png) [@Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/u/Kazuhiro_NISHIYAMA)\
**Post date:** [October 21, 2008, 11:13am UTC](https://www.ruby-forum.com/t/bug-672-rb-io-flush-in-pipe-open/151428/1 "2008-10-21T11:13:21Z")

</div>

Bug #672: rb\_io\_flush in pipe\_open  
[http://redmine.ruby-lang.org/issues/show/672](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);

---

<div class="post-metadata">

**Author:** ![Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/77aa72/32.png) [@Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/u/Kazuhiro_NISHIYAMA)\
**Post date:** [October 22, 2008, 10:38am UTC](https://www.ruby-forum.com/t/bug-672-rb-io-flush-in-pipe-open/151428/2 "2008-10-22T10:38:00Z")

</div>

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](http://redmine.ruby-lang.org/issues/show/672)
