From: Lennon Day-Reynolds Date: 2004-09-17T06:12:08+09:00 Subject: Re: expect.rb in 1.8.2 Phil, The 'expect.rb' library uses 'select()', which only works for sockets on Windows, not regular file handles, IIRC. Looking at the source, though, it seems to only work on a single file handle at a time, anyway, so I'm not sure what it buys you something like the uber-simple version below. -- 'miniexpect.rb' require 'timeout' class IO def expect(pat, wait=9999999) result = nil buff = '' begin timeout(wait) do c = getc.chr buff << c if pat.match(buff) result = [buff, *mat.to_a[1..-1]] end end rescue Timeout::Error; end if block_given? yield result else return result end end end -- -- Lennon rcoder.net