From: Luis Lavena Date: 2010-07-24T03:48:50+09:00 Subject: [ruby-core:31462] IO.new do not inherit the mode specified in IO.sysopen? Hello, I'm checking the documentation of IO.new and what are the default modes it uses when opening a new file. File.delete('test') if File.exist?('test') fd = IO.sysopen('test', 'w') io = IO.new fd io.sync = true io.print 'test data' io.close puts IO.read('test') == 'test data' IO.sysopen indicated that the file descriptor was open for writing, but IO.new didn't honor it. Wanted to know if this is a limitation or a problem only in Windows, as IO.sysopen + IO.new works perfectly under Linux: $ ruby -v t.rb ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux] true $ ruby -v t.rb ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux] true $ ruby -v t.rb ruby 1.9.2dev (2010-07-11 revision 28618) [i686-linux] true But Windows result on IOError: >ruby -v t.rb ruby 1.8.7 (2010-06-23 patchlevel 299) [i386-mingw32] t.rb:6:in `write': not opened for writing (IOError) from t.rb:6:in `print' from t.rb:6 >ruby -v t.rb ruby 1.9.2dev (2010-07-02) [i386-mingw32] t.rb:6:in `write': not opened for writing (IOError) from t.rb:6:in `print' from t.rb:6:in `
' Thank you. -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup�ry