On Sun, 18 Jan 2004, Ferenc Engard wrote: > Date: Sun, 18 Jan 2004 21:39:41 +0900 > From: Ferenc Engard <ferenc / engard.hu> > Newsgroups: comp.lang.ruby > Subject: running external process? > > Hi all, > > Is there a simple way to spawn an external program, feed its stdin, and > get its stdout? > > The problem with popen is, if I want to feed a few MB's of input to it, > then it hangs (I suspect that its stdout IO buffer is full) before I > could read out its stdout on the next line. So, the following do not > work: > > io=IO.popen("externalfilter") > io.write(verybigstring) io.close # the program is still reading it's stding here > result=io.read > > Thanks, > Ferenc -a -- ATTN: please update your address books with address below! =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | STP :: http://www.ngdc.noaa.gov/stp/ | NGDC :: http://www.ngdc.noaa.gov/ | NESDIS :: http://www.nesdis.noaa.gov/ | NOAA :: http://www.noaa.gov/ | US DOC :: http://www.commerce.gov/ | | The difference between art and science is that science is what we | understand well enough to explain to a computer. | Art is everything else. | -- Donald Knuth, "Discover" | | /bin/sh -c 'for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done' ===============================================================================