Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add test and fix posing as instantiating class for pipes

  • Loading branch information...
commit 875d8a1421cc631cc2dab3a08fbc4637553509a6 1 parent 74a0643
@timfel timfel authored
Showing with 6 additions and 2 deletions.
  1. +2 −2 src/kernel/post_prims/IO.rb
  2. +4 −0 src/test/github313.rb
View
4 src/kernel/post_prims/IO.rb
@@ -17,8 +17,8 @@ def self.pipe
pipefds = FFI::MemoryPointer.new :int, 2
raise "Error creating pipes" if __cfunctions.pipe(pipefds) != 0
# r,w = File.__fopen(pipefds[0], 'r'), File.__fopen(pipefds[1], 'w')
- r = Pipe.__send__(:new, pipefds[0], 'r', self.class)
- w = Pipe.__send__(:new, pipefds[1], 'w', self.class)
+ r = Pipe.__send__(:new, pipefds[0], 'r', self)
+ w = Pipe.__send__(:new, pipefds[1], 'w', self)
if block_given?
begin
return yield(r,w)
View
4 src/test/github313.rb
@@ -23,3 +23,7 @@
expected = "ping pong\nping pong\nping pong\nping pong\nping "
raise "IO select did not work" unless result == expected
+
+unless rp.class == IO
+ raise "Pipes should pose as instantiating class, so matching in case statements works"
+end
Please sign in to comment.
Something went wrong with that request. Please try again.