From: Shay Hawkins Date: 2010-01-05T06:00:42+09:00 Subject: Re: "Dummy" IO object to push and pull data? Brian Candler wrote: > What happens if you run this under Windows? C:\Users\Shay\Desktop>ruby prg1.rb 15:51:20 > Awaiting data... 15:51:21 Output: -2 15:51:21 > Awaiting data... Then nothing else happens. I'm 90% sure this is because Windows, being the operating system that it is, holds up everything when .gets() is called on stdin until something is provided. Brian Candler wrote: > Now, this slightly muddies the water because prg2.rb also depends on > being able to select(), as I wanted it to be able to sleep *and* receive > data on stdin, the same as your main program does. So it would be also > interesting to know what happens if you do "ruby prg2.rb" by itself. It > *should* print a new number every 2 seconds, and if you type something > onto stdin, it should echo it back as >>> Received ... <<< C:\Users\Shay\Desktop>ruby prg2.rb -2 C:\Users\Shay\Desktop>Hello World! >>> Received Hello World! <<< -1 C:\Users\Shay\Desktop>Blah~ >>> Received Blah~ <<< 0 And so forth and so on. Brian Candler wrote: > (*) Incidentally: for someone to reproduce this problem, they'll need to > know exactly what platform you have. You said "Windows Vista" but you > didn't say which version of Ruby, nor which package (Cygwin? One-Click > Installer? Other?) C:\Users\Shay\Desktop>ruby -v ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] The program I used to install it (or at least what I have in my downloads folder) is ruby186-27_rc2 from rubyinstaller.rubyforge.org. -- Posted via http://www.ruby-forum.com/.