I'm using Windows and I want write to a Programm, after I recived a respones someway like this:
Open3.popen3("ruby echo.rb") do |stdin, stdout, stderr, wait|
stdin.puts("Hello\n")
stdin.close
got_this = stdout.read
stdin.reopen # <- Not an existing function. What to do here?
stdin.puts(got_this)
puts stdout.read
stdin.close
end
My problem is, that it seems like I can't read the input before closing the output stream. I already found this post but it seems like there is no PTY support on Windows: ruby popen3 -- how to repeatedly write to stdin & read stdout without re-opening process?
This is the code of the echo.rb:
t = gets.chomp
puts "10"
t = gets.chomp
puts t+t