How to write and read from process with Ruby? I wrote this, but it didn`t work...
output = IO.popen("irb", "r+") do |pipe| pipe.gets pipe.puts "10**6" pipe.gets pipe.puts "quit" end
I rewrite so
IO.popen("irb", "w+") do |pipe| 3.times {puts pipe.gets} # startup noise pipe.puts "10**6\n" puts pipe.gets # I expect " => 1000000" pipe.puts "quit" # I expect exit from irb endbut It didn`t work too