Robert Klemme wrote:
> 2010/3/8 James Coglan <jcoglan / googlemail.com>:
> 
>> If I run an external process, e.g.
>>
>> IO.popen('cucumber')
>>
>> Then Ruby blocks while waiting for the whole output of the subprocess.
> 
> IO.popen does not block anything.  You would at least have to read
> from or write to the stream in order to get a chance of blocking.

Although the OP didn't mention the platform, as Windows can be broken 
with regards to forking.

But I just tried it with the one-click installer under XP, and it seems 
to be fine:

ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]

>> c = IO.popen("pause","w+")
=> #<IO:0x2bea818>
>> c.readpartial(1024)
=> "Press any key to continue . . . "
>> c.puts
=> nil
>> c.readpartial(1024)
=> "\n"
>> c.readpartial(1024)
EOFError: end of file reached

(readpartial reads between 1 and the given number of bytes, depending on 
how many are available at the time)
-- 
Posted via http://www.ruby-forum.com/.