diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | io.c | 2 | ||||
-rw-r--r-- | test/ruby/test_io_m17n.rb | 10 |
3 files changed, 15 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Tue Apr 27 06:20:13 2010 Tanaka Akira <akr@fsij.org> + + * io.c (select_internal): IO which cbuf is not empty is readable. + Tue Apr 27 00:07:32 2010 Yusuke Endoh <mame@tsg.ne.jp> * parse.y (program): check void_expr when rb_parse_in_main(). @@ -7153,7 +7153,7 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd for (i=0; i<RARRAY_LEN(read); i++) { GetOpenFile(rb_io_get_io(RARRAY_PTR(read)[i]), fptr); rb_fd_set(fptr->fd, &fds[0]); - if (READ_DATA_PENDING(fptr)) { /* check for buffered data */ + if (READ_DATA_PENDING(fptr) || READ_CHAR_PENDING(fptr)) { /* check for buffered data */ pending++; rb_fd_set(fptr->fd, &fds[3]); } diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index 98a52939d0..218a60b044 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -1774,5 +1774,15 @@ EOT } end + + def test_cbuf_select + with_tmpdir { + r, w = IO.pipe + w << "\r\n" + r.set_encoding("US-ASCII:UTF-8", :universal_newline => true) + r.ungetc(r.getc) + assert_equal([[r],[],[]], IO.select([r], nil, nil, 1)) + } + end end |