diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-11-24 11:00:35 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-11-24 11:00:35 +0000 |
commit | bee4e843ce20dd899eb86fd2f6947e6573b20465 (patch) | |
tree | 650ca22716ea254104f00d4be14884cfb4dfe3b0 /io.c | |
parent | 7e35d6fcaa773afc4f492689471f5687cc41c814 (diff) | |
download | ruby-bee4e843ce20dd899eb86fd2f6947e6573b20465.tar.gz |
* io.c (rb_io_reopen): re-initialize buffereing mode for stdout and
stderr.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -6151,6 +6151,14 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file) if (setvbuf(fptr->stdio_file, NULL, _IOFBF, 0) != 0) rb_warn("setvbuf() can't be honoured for %s", RSTRING_PTR(fptr->pathv)); #endif + if (fptr->stdio_file == stderr) { + if (setvbuf(fptr->stdio_file, NULL, _IONBF, BUFSIZ) != 0) + rb_warn("setvbuf() can't be honoured for %s", RSTRING_PTR(fptr->pathv)); + } + else if (fptr->stdio_file == stdout && isatty(fptr->fd)) { + if (setvbuf(fptr->stdio_file, NULL, _IOLBF, BUFSIZ) != 0) + rb_warn("setvbuf() can't be honoured for %s", RSTRING_PTR(fptr->pathv)); + } } else { if (close(fptr->fd) < 0) |