Francis Cianfrocca wrote:
>>>> Well, b*****it:
> -------------------------------
> $stdout.sync = true
> rd, wr = IO.pipe
> 
> Thread.new do
> loop do
>   puts 'foo!'
>   sleep 0.5
> end
> end
> 
> sleep 2
> puts(rd.gets)
> -------------------------------
> <<<
> 
> 
> Joel already caught the obvious error in this code. It's also possible
> you'll hit a platform-dependence with half/full duplex descriptors. Are you
> using Windows or Unix-like?

Thanks to Joel and you but no.

The problem isn't that rd.gets waits forever - i didn't described my
problem well enough obviously. The problem is: i get 4 foo!s not one
more. Not only the main thread blocks at the gets but all other ruby
threads do also block. This defeats the whole purpose of using a pipe
in the first place.

And yes: ruby 1.8.4 (2005-12-24) [i386-mswin32] is on windows.

cheers

Simon