In the receiver, you are constantly opening the pipe for read and then 
closing it. I expect that if someone writes to the pipe while there's no 
reader, the data is lost.

The program works for me if I swap the open and while around:

    File.open("#{RAILS_ROOT}/#{PIPE}", "r") do |pipe|
      while term_count < NUMBER_OF_ORDERS
        val = pipe.gets
        if val.match(/DONE/)
          .. etc

But it is much better form to create an anonymous pipe in the parent 
(rd, wr = IO.pipe) then fork. Close the rd end in the child and the wr 
end in the parent.

Use Socket.pair if you want a bidirectional channel.
-- 
Posted via http://www.ruby-forum.com/.