From: Hal Fulton Date: 2004-06-04T13:43:44+09:00 Subject: playing with popen again Why doesn't this work? prog1 calls prog2... the latter starts by writing a line, then reading a line. The former reads first, then writes. It hangs indefinitely. When I kill prog1, it appears that I interrupted a gets on each side. What am I doing that's stupid? Thanks, Hal # prog1 io = IO.popen("ruby prog2.rb","r+") str = io.gets puts "got: #{str}" io.puts "junk" str = io.gets puts "got: #{str}" io.puts "junk" str = io.gets puts "got: #{str}" io.puts "junk" #!/usr/local/bin/ruby # prog2 puts "This is prompt 1" gets puts "This is 2nd prompt" gets puts "3rd/final prompt" gets $ ruby prog1.rb # and then ctl-C prog1.rb:2:in `gets': Interrupt from prog1.rb:2 prog2.rb:3:in `gets': Interrupt from prog2.rb:3