On Tue, 09 Sep 2003 14:11:19 -0600 Eric Schwartz <emschwar / pobox.com> wrote: > Eric Schwartz <emschwar / pobox.com> writes: > > I've tried: > > > > IO.popen('/usr/games/jive', 'w+') { |io| > > io.puts "What is going on?" > > puts io.gets > > } > > > > But it just hangs at the gets. > > Okay, after a fair amount of searching, including some blind guessing, > I came across some old ruby-talk posts mentioning Open3, which seems > to do what I want: > > Open3.popen3('jive') { |wtr,rdr,err| > wtr.puts "what is up?" > wtr.close > puts rdr.gets > } > > This points up my major frustration with Ruby-- I had to completely > guess as to how Open3 worked, or *even that it existed at all*. There > are no docs I can find for it, and this makes developing with Ruby > more of a pain than it needs to be. If I were doing this in perl, I'd > just have to 'perldoc -q pipe', and instantly I have docs on > IPC::Open2 and a reference to IPC::Open3 if I need that. Yes, you're right, the documentation should be better. Of course, if you look at open3.rb, you'll see this: # Usage: # require "open3" # # in, out, err = Open3.popen3('nroff -man') # or # include Open3 # in, out, err = popen3('nroff -man') HOWEVER, this doesn't even work because 'in' is a keyword in Ruby! That, IMHO, should be fixed. (Both this specific case and documentation for libraries in general. However, I obviously don't care *that* much, otherwise I'd be writing documentation right now.) Jason Creighton