Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IO.new will be able to decide an access mode from a given descriptor.
Test Script: {{{ require 'test/unit/assertions.rb' include Test::Unit::Assertions fd = IO.sysopen("/tmp/test.txt", "w", 0666) f = IO.new(fd) f.write("foo\nbar\nbaz") f.close File.open("/tmp/test.txt") {|f| assert_equal("foo\nbar\nbaz", f.read) } assert_raise(Errno::EBADF){ IO.new(-1) } assert_raise(Errno::EBADF){ IO.new(32767) } puts :ok }}}
- Loading branch information