title: How to iterate over popen output?
body: <p>I have this simple ruby script:</p>
  
  <pre><code>redcricket@dev-006:~$ cat simple.rb  
  #!/usr/local/bin/ruby
  
  IO.popen 'ls -l', 'r+' do |f|
          puts f.gets
  end
  </code></pre>
  
  <p>and when I run it the only output I get is this ...</p>
  
  <pre><code>redcricket@dev-006:~$ ./simple.rb  
  total 32
  </code></pre>
  
  <p>... what I expected was this ...</p>
  
  <pre><code>redcricket@smp-mig-dev-006:~$ ls -l
  total 32
  drwxr-xr-x  4 redcricket co 4096 Dec  5 12:23 applications
  -rw-r--r--  1 redcricket co  464 Oct  5 16:23 config
  drwxr-xr-x 72 redcricket co 4096 Dec  5 15:11 docs
  drwxr-xr-x  3 root    root  4096 Dec  5 12:14 oradiag_root
  drwxr-xr-x  5 redcricket co 4096 Dec  5 16:22 platform
  -rwxr-xr-x  1 redcricket co  373 Dec  5 16:30 process_yum_output.rb
  -rwxr-xr-x  1 redcricket co 2159 Nov 28 16:24 SetupSSHPK.sh
  -rwxr-xr-x  1 redcricket co  142 Dec  5 16:31 simple.rb
  </code></pre>
  
  <p>... I guess I need to iterate over f.gets somehow?</p>
  
  <p>Thanks!</p>