From 64239e22918a43ca23bdc477a373644ca5b200ac Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 17 Jan 2008 15:49:33 +0000 Subject: [PATCH] * io.c (rb_io_check_readable): flush tied write IO too. * io.c (Init_IO): tie stdin with stdout. [ruby-core:15107] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ io.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index a0162e9234..2b2a4c47ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Jan 18 00:49:31 2008 Nobuyoshi Nakada + + * io.c (rb_io_check_readable): flush tied write IO too. + + * io.c (Init_IO): tie stdin with stdout. [ruby-core:15107] + Fri Jan 18 00:23:31 2008 Nobuyoshi Nakada * encoding.c (enc_free): removed since rb_encoding may be used while diff --git a/io.c b/io.c index 597f56cfe0..12295c8ff7 100644 --- a/io.c +++ b/io.c @@ -363,6 +363,11 @@ rb_io_check_readable(rb_io_t *fptr) if (fptr->wbuf_len) { io_fflush(fptr); } + if (fptr->tied_io_for_writing) { + rb_io_t *wfptr; + GetOpenFile(fptr->tied_io_for_writing, wfptr); + io_fflush(wfptr); + } if (!fptr->enc && fptr->fd == 0) { fptr->enc = rb_default_external_encoding(); } @@ -6647,6 +6652,7 @@ Init_IO(void) rb_define_hooked_variable("$>", &rb_stdout, 0, stdout_setter); orig_stdout = rb_stdout; rb_deferr = orig_stderr = rb_stderr; + RFILE(rb_stdin)->fptr->tied_io_for_writing = rb_stdout; /* constants to hold original stdin/stdout/stderr */ rb_define_global_const("STDIN", rb_stdin);