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.
Pardon the gripiness, please, but I really hate guessing about my
programming language. POLS is nice, but having easily accessible docs
to confirm all the corner cases is even better, IMO.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.