Issue #5952 has been updated by Tomoyuki Chikanaga.

Category set to core

r29781 篁ラ?? Kernel#readlines (ARGF.readlines) ??? EOF ???罎???冴???????? stdin ??? close ????????????????c??????????????с?????篁ヤ????????????泣?潟?????х院???腆肴????с????障?????

readlines.rb:
p STDIN.closed?   # => false
p readlines       # => []  <- Ctrl-D ??? EOF ?????????
p STDIN.closed?   # => true
p readlines       # => []  <- ???????????????c?????

1.9.2 ??с???緇???? STDIN.closed? ??? false ???障?障?с??2綺??? readlines ???ュ?????緇???<?障?????

ARGF.current_file ???罔?羣???ュ???????c????? close ???????????????????????????????????????膠???眼????障????????????????с?????с???????????

diff --git a/io.c b/io.c
index a3a45c0..e877f13 100644
--- a/io.c
+++ b/io.c
@@ -7684,7 +7684,8 @@ argf_readlines(int argc, VALUE *argv, VALUE argf)
        }
        else {
            lines = rb_io_readlines(argc, argv, ARGF.current_file);
-           argf_close(ARGF.current_file);
+           if ( ARGF.current_file != rb_stdin )
+               argf_close(ARGF.current_file);
        }
        ARGF.next_p = 1;
        rb_ary_concat(ary, lines);



----------------------------------------
Bug #5952: ??潟????潟?????ゃ?潟?≪?若????? CGI.new ??? 2 ???絎?茵?????????? IOError ?????榊????????
https://bugs.ruby-lang.org/issues/5952

Author: Hiroshi SHIBATA
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 1.9.3
ruby -v: ruby 1.9.3p28 (2012-01-28 revision 34386) [x86_64-darwin11.2.0]


=begin
1.9.3p28, trunk ??т札筝????鴻??????????絎?茵??????????2??????? CGI.new ??? ??????<?若?帥???????????????????? IOError ?????榊???????障?????
 % cat cli.rb
 require 'cgi'
 CGI.new
 CGI.new

 % ruby cli.rb     
 (offline mode: enter name=value pairs on standard input)
 /Users/hsbt/.rbenv/versions/2.0.0-dev/lib/ruby/2.0.0/cgi/core.rb:595:in `tty?': closed stream (IOError)
 	from /Users/hsbt/.rbenv/versions/2.0.0-dev/lib/ruby/2.0.0/cgi/core.rb:595:in `read_from_cmdline'
 	from /Users/hsbt/.rbenv/versions/2.0.0-dev/lib/ruby/2.0.0/cgi/core.rb:645:in `initialize_query'
 	from /Users/hsbt/.rbenv/versions/2.0.0-dev/lib/ruby/2.0.0/cgi/core.rb:806:in `initialize'
 	from cli.rb:4:in `new'
 	from cli.rb:4:in `<main>'
 
1.9.2p290 ??? 1.8.7p357 ??с????若???2?????????<?若?帥????ュ????純?с?????
=end


-- 
http://bugs.ruby-lang.org/