On Aug 2, 2007, at 10:40 AM, Hans Fugal wrote:

> cmd1 = ['oggdec','-o','-',oldpath]
> cmd2 = ['lame','-',newpath]
>
> I think I can do the following,
>
> IO.popen('-','r') do |p1|
>   exec cmd1 unless p1
>   IO.popen('-','w') do |p2|
>     exec cmd2 unless p2
>     p2.write(p1.read)
>   end
> end
>

an alternative:

cfp:~ > ruby a.rb
1073741824
1073741824



cfp:~ > cat a.rb
require 'open4'

cmd1 = 'ruby -e"  (2 ** 10).times{ STDOUT.write 0.chr * 2**20 }  "'
cmd2 = 'ruby -e"   puts ARGF.read.size  "'

stdin = IO.popen cmd1

stdout, stderr = '', ''

status = Open4.spawn cmd2, 0=>stdin, 1=>stdout, 2=>stderr

puts stdout
puts 2 ** 30



a @ http://drawohara.com/
--
we can deny everything, except that we have the possibility of being  
better. simply reflect on that.
h.h. the 14th dalai lama