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 =3D IO.sysopen('test', 'w')
io =3D IO.new fd
io.sync =3D true
io.print 'test data'
io.close

puts IO.read('test') =3D=3D '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 `<main>'


Thank you.
--=20
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=E9ry