From: Wakou Aoyama Date: 2000-05-25T17:58:41+09:00 Subject: [ruby-dev:9848] Re: timeout.rb 青山です。 まだダメでした。ちょっと現象がはっきりしないのですが、次のコードで、あ るときから(多くは約10回以下の繰り返し以内)、タイムアウトしなくなります。 (getc の状態のまま止まる。入力は受け付けるので、キーボードで改行を打つ と正常終了。) require "net/telnet" host = Net::Telnet::new("Host" => "localhost") host.login("user", "password") require "timeout" loop() do begin timeout(1) do if $stdin.getc == ?\n host.print("exit") exit end end rescue TimeoutError end begin print host.cmd("ls") rescue EOFError exit end end -- 青山 和光 Wakou Aoyama