Rubyで、パイプのようなものを実現するにはどうしたらいいですか
input = "aaa¥nbbb¥nccc¥n"
output = open("|cat -n", "r+b") do |io|
 io.write(input) if input
 io.read
end
でいけるかなと思ったのですが、io.read()でブロックされるようで、うまくいきません。