[macruby-changes] [MacRuby/MacRuby] e98990: IO#initialize_copy will not raise an exception whe...

noreply at github.com noreply at github.com
Mon May 2 09:47:43 PDT 2011


Branch: refs/heads/master
Home:   https://github.com/MacRuby/MacRuby

Commit: e989907e053cd5a1aa0cab5893dcffa71a303395
    https://github.com/MacRuby/MacRuby/commit/e989907e053cd5a1aa0cab5893dcffa71a303395
Author: Watson <watson1978 at gmail.com>
Date:   2011-05-02 (Mon, 02 May 2011)

Changed paths:
  M io.c

Log Message:
-----------
IO#initialize_copy will not raise an exception when was passed same descriptor as receiver if descriptor already closed.

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

io = STDOUT
io.close_write
assert_nothing_raised{ io.send(:initialize_copy, STDOUT) }

puts :ok
}}}


Commit: 23ddb9ea925c9d7201211d1c9ea9a0ba856cf798
    https://github.com/MacRuby/MacRuby/commit/23ddb9ea925c9d7201211d1c9ea9a0ba856cf798
Author: Watson <watson1978 at gmail.com>
Date:   2011-05-02 (Mon, 02 May 2011)

Changed paths:
  M io.c

Log Message:
-----------
IO#dup will duplicate the write descriptor that was made with IO.popen.

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

begin
  MACRUBY_VERSION
  ruby = "macruby"
rescue
  ruby = "ruby19"
end

args = ['-e', '$>.write($<.read)']
f = IO.popen([ruby] + args, 'r+')

f2 = f.dup
assert_equal(f.pid, f2.pid)

f.puts "foo"
f2.puts "bar"

f.close_write
f2.close_write

assert_equal("foo\nbar\n", f.read)
assert_equal("", f2.read)

puts :ok
}}}


Compare: https://github.com/MacRuby/MacRuby/compare/fbaff4e...23ddb9e


More information about the macruby-changes mailing list