aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--io.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/io.c b/io.c
index 3331d7c6a9..0f8da47751 100644
--- a/io.c
+++ b/io.c
@@ -801,8 +801,13 @@ static int
io_getc(OpenFile *fptr)
{
int r;
- if (fptr->fd == 0 && (fptr->mode & FMODE_TTY)) {
- rb_io_flush(rb_stdout);
+ if (fptr->fd == 0 && (fptr->mode & FMODE_TTY) &&
+ TYPE(rb_stdout) == T_FILE) {
+ OpenFile *ofp;
+ GetOpenFile(rb_stdout, ofp);
+ if (ofp->mode & FMODE_TTY) {
+ rb_io_flush(rb_stdout);
+ }
}
if (fptr->rbuf == NULL) {
fptr->rbuf_off = 0;