If I run:

     f = open("|-", "w+")
     if f == nil
        print "in Child\n"
     else
        print "Got: ", f.gets, "\n"
     end

it outputs

     Got: in Child


However,

     open("|-", "w+") { |f|
       if f == nil
          print "in Child\n"
       else
          print "Got: ", f.gets, "\n"
       end
     }

outputs

     Got: nil



What am I misunderstanding here?



Thanks

Dave