On Fri, Nov 6, 2009 at 5:15 AM, Robert Klemme <shortcutter / googlemail.com> wrote: > 2009/11/5 Robert Citek <robert.citek / gmail.com>: >> However, if I change the cat command to a sed command, the ruby >> version no longer works. The command-line equivalent does work, but >> the ruby version waits forever and has to be interrupted: > > That's probably because you do not close the write end of the pipe in > Ruby code. Perhaps, but what if I don't want to close the pipe? That is, I would like to keep the pipe open so that I can send some data, read some data and work on it, send some more data, read some more data and work on it, etc. much like the process was a service, e.g. database. I am trying to code the equivalent of a Call and Response. My examples using cat and sed are just stand-ins for the real program. BTW, the cat example works as expected, but the using sed doesn't work. That is, there is no output from sed until the pipe closes. There seems to be some buffering going on. I'm guessing it's from the Ruby side since I don't see this when run from the shell. But that's just a guess. Of course, it's entirely possible that IO.popen is not the "right" way to tackle this and I have not discovered the Ruby way, yet. Again, any pointers in the right direction are greatly appreciated. Regards, - Robert