On Tuesday, 22 April 2003 at 19:23:31 +0900, Brian Candler wrote: > On Tue, Apr 22, 2003 at 07:06:38PM +0900, Jim Freeze wrote: > > There seems to be a lot of people asking for this and I have read > > a lot of responses on ruby-talk, but most of the threads end before > > a final solution is obtained. So far, the link below looks the > > most promising: > > > > http://groups.google.com/groups?q=%2Bselect+%2Bopen3+group:comp.lang.ruby&hl=en&lr=&ie=UTF-8&group=comp.lang.ruby&selm=E13wxQm-0005FP-00%40ev.netlab.zetabits.co.jp&rnum=5 > > That's an old post. I believe popen itself now supports bi-directional > communication natively. > > a = IO.popen("nroff -man","w+") > Thread.new do > while line = gets > a.print line > end > a.close_write > end > while line = a.gets > print ":", line > end > a.close_read > > (This works under Unix for version 1.6.8, I seem to recall that it was fixed > for Windows in 1.7.something) Thanks. This works great! Exactly what I was looking for. -- Jim Freeze ---------- There are people so addicted to exaggeration that they can't tell the truth without lying.