1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/io/console/console.c (get_write_fd): return primary fd if no

io is tied for writing.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-05-13 09:45:29 +00:00
parent 8653bd97de
commit 30f637024b
3 changed files with 15 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Thu May 13 18:45:25 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/io/console/console.c (get_write_fd): return primary fd if no
io is tied for writing.
Thu May 13 18:15:33 2010 NAKAMURA Usaku <usa@ruby-lang.org>
* io.c (swallow): should use more_char() instead of fill_cbuf().

View file

@ -164,7 +164,7 @@ get_write_fd(const rb_io_t *fptr)
{
VALUE wio = fptr->tied_io_for_writing;
rb_io_t *ofptr;
if (!wio) return -1;
if (!wio) return fptr->fd;
GetOpenFile(wio, ofptr);
return ofptr->fd;
}

View file

@ -70,4 +70,13 @@ class TestIO_Console < Test::Unit::TestCase
}
end
def test_oflush
PTY.open {|m, s|
s.print "a\n"
s.oflush
s.print "b\n"
assert_equal("b\r\n", m.readpartial(10))
}
end
end