From: Brian Candler Date: 2010-03-10T21:28:37+09:00 Subject: Re: Capturing incremental output from STDOUT Robert Klemme wrote: > 2010/3/8 James Coglan : > >> 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+") => # >> 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/.