I’d like to spawn a process, then write some stuff to it, then read
stuff from it, then write more, then read more, etc etc. (Ruby 1.9 and
The way that I’ve done this is something like:
input, output, err = Open3.popen3(‘cmd’)
input.puts ‘echo hi’
input.puts ‘echo bye’
This seems mostly okay, but I have a couple questions.
- In IO/wait, there’s a method called “ready?”. If I call “ready?” in
this program, it returns false even when stat.size indicates that there
actually IS in fact data to be read. I’m having trouble understanding
- In IO/wait, there’s a method called “nread”. However, if I call
output.methods.sort, it’s not there and I cant use it. I see “ready?”
and “wait”, but no “nread”.
- I’m sure I’m not the first bozo to complain about the
documentation…but the primary documentation for ruby’s standard
libraries (ruby-doc.org) is pretty sucky. I’m just feeling frustrated
atm. It took me a lot of hours to come up with the little code that I
have >_<. Is there an alternative site that has more meaningful
I just signed up for the ruby documentation mailing list so I can make
some suggestions…but is there maybe an easier way? It would be nice
if there was just some form that I could fill out and say “on this page
it says X, but it would be more helpful if it said Y”. Or even a wiki
version of the API.