From: Robert Klemme Date: 2010-01-05T21:45:06+09:00 Subject: Re: "Dummy" IO object to push and pull data? On 01/04/2010 10:00 PM, Shay Hawkins wrote: > 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. Actually part of that functionality is in Ruby itself because IO uses buffering by default. For tests like these it helps to place a line like this at the beginning of the script: $stdout.sync = $stderr.sync = true As far as I can see this wasn't done in Brian's test scripts so repeating with that line introduced will likely yield more accurate results. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/