Ruby Open3.popen3 hangs when trying to get output

32 Views Asked by At

I am trying to work through the following example given in my course notes:

require 'open3' 
sin,sout,serr=Open3.popen3('nslookup')
sin.puts "www.google.co.nz" 
print(sout.gets)

For some reason the code is hanging. I tried executing it in interactive mode and when I entered the last line and then pressed control c, reentering the command worked. Please assist.

0

There are 0 best solutions below