[MacRuby/MacRuby] 5912f7: IO.new will be able to decide an access mode from ...
Branch: refs/heads/master Home: https://github.com/MacRuby/MacRuby Commit: 5912f765af272c372f7116c5fcf8139f9dc600ea https://github.com/MacRuby/MacRuby/commit/5912f765af272c372f7116c5fcf8139f9d... Author: Watson <watson1978@gmail.com> Date: 2011-05-05 (Thu, 05 May 2011) Changed paths: M io.c Log Message: ----------- 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 }}}
participants (1)
-
noreply@github.com