From: James Smith Date: 2006-11-08T09:54:28+09:00 Subject: Two way communication with the command shell (IO.popen?) Hi, I would basically like to be able to run a ruby program from my rails application and be able to read from it and write to it accordingly. OK, i am currently using: IO.popen("ruby ruby_program.rb", "r+") do |f| @read = f.read @write = f.write #this is where i need help end say if the external ruby program was as follows: 0 def readWrite 1 puts "printing.." 2 @string = gets 3 end 4 readWrite I can currently read (in example) "printing..", however when it reaches line 2 of the ruby program, i can't seem to write to it, and my rails program just waits. I need to use something that says "read from program until it is waiting for input, and then write to it" (also, when writing to the program, how do i emulate the user pressing enter - \n? ) Thanks -- Posted via http://www.ruby-forum.com/.