Skip to content

Commit

Permalink
IO.pipe will return subclass instances based on receiver.
Browse files Browse the repository at this point in the history
Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

class SubIO < IO; end

r, w = SubIO.pipe
assert_equal(SubIO, r.class)
assert_equal(SubIO, w.class)

puts :ok
}}}
  • Loading branch information
Watson1978 committed May 3, 2011
1 parent d12c76d commit f0d3850
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions io.c
Expand Up @@ -4021,8 +4021,8 @@ rb_io_s_pipe(VALUE recv, SEL sel, int argc, VALUE *argv)
rb_sys_fail("pipe() failed");
}

rd = prep_io(fd[0], FMODE_READABLE, rb_cIO);
wr = prep_io(fd[1], FMODE_WRITABLE, rb_cIO);
rd = prep_io(fd[0], FMODE_READABLE, recv);
wr = prep_io(fd[1], FMODE_WRITABLE, recv);

return rb_assoc_new(rd, wr);
}
Expand Down

0 comments on commit f0d3850

Please sign in to comment.