diff --git a/ChangeLog b/ChangeLog index 486ec517f5..226a69edef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Apr 27 06:20:13 2010 Tanaka Akira + + * io.c (select_internal): IO which cbuf is not empty is readable. + Tue Apr 27 00:07:32 2010 Yusuke Endoh * parse.y (program): check void_expr when rb_parse_in_main(). diff --git a/io.c b/io.c index 30150fc507..b1ca613169 100644 --- a/io.c +++ b/io.c @@ -7153,7 +7153,7 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd for (i=0; ifd, &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