From: Kazuhiro Yoshida Date: 2003-07-26T16:59:42+09:00 Subject: [ruby-dev:20915] [BUG] errno == 0 もりきゅうです。win32だけかもしれません。 # いつぞや同じような報告をした覚えがありますが (ruby-dev:19299) D:\tmp>type stdin18.rb class RubyIO < IO Buffer = %w/begin ruby end/.map{|i|i<<"\n"} def gets Buffer.shift end end io = RubyIO.new(4) #$stdin = io STDIN.reopen(io) while gets print end D:\tmp>ruby\bin\ruby -vd stdin18.rb ruby 1.8.0 (2003-07-24) [i386-mswin32] stdin18.rb:7: [BUG] rb_sys_fail() - errno == 0 ruby 1.8.0 (2003-07-24) [i386-mswin32] This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. D:\tmp> ところで1.8では$stdin(or STDIN)はIOクラスのインスタンスでないといけなく なったんでしょうか。仮にそうだとして、IO.new には引数としてfdを渡さない といけないとしたら、IOに結びついていないオブジェクトは設定できないという ことになるのでしょうか。GUIコンソールをSTDINに結び付けたいのです。 1.6.8なら自由に設定できました: D:\tmp>type stdin16.rb class RubyIO Buffer = %w/begin ruby end/.map{|i|i<<"\n"} def gets Buffer.shift end end io = RubyIO.new $stdin = io while gets print end D:\tmp>ruby -vd stdin16.rb ruby 1.6.8 (2002-12-24) [i586-mswin32] begin ruby end D:\tmp> ---- YOSHIDA Kazuhiro moriq@moriq.com http://www.moriq.com/