[MacRuby] #1400: IO.popen with "w" flag creates an object with wrong descriptor.

MacRuby ruby-noreply at macosforge.org
Tue Oct 4 20:24:52 PDT 2011


#1400: IO.popen with "w" flag creates an object with wrong descriptor.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 IO.popen with "w" flag creates an object with wrong descriptor.
 So, When open the files before closing object which is created by
 IO.popen,
 MacRuby can't handle those files correctly.

 Test Script:
 {{{
 #!ruby
 #child = IO.popen("echo", "r")
 child = IO.popen("cat", "w")
 p child

 file = open("/tmp/test", "r+")
 child.close

 p file.fileno
 p file.closed?
 p file.read

 file.close
 }}}

 IO.popen's object and File's object have same descriptor.

 {{{
 $ macruby test_popen.rb
 #<IO:fd 3>
 3
 false
 /Users/watson/tmp/test_popen.rb:10:in `<main>': Bad file descriptor -
 read() failed (Errno::EBADF)
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1400>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list