Edward Middleton wrote:
> I am trying to write a wrapper for a program with an interactive shell,

You might want to look at rexpect.rb or expect.rb.  I think expect.rb is
distributed with Ruby, rexpect.rb is available on rubyforge.

Ben