Mega Code Archive

 
Categories / Ruby / File Directory
 

Open a program with a readwrite IO stream and handle data in both directions

handle = IO.popen("other_program", "r+") handle.puts "send input to other program" handle.close_write while line = handle.gets   puts line end