Backport of Ruby 1.9's Open3 methods to Ruby 1.8