Browse files

add test and fix posing as instantiating class for pipes

  • Loading branch information...
1 parent 74a0643 commit 875d8a1421cc631cc2dab3a08fbc4637553509a6 @timfel timfel committed Mar 3, 2014
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

0 comments on commit 875d8a1

Please sign in to comment.