From: Matt Armstrong Date: 2002-03-13T08:48:11+09:00 Subject: Re: gzip again... Paul Brannan writes: > On Wed, Mar 13, 2002 at 02:04:19AM +0900, Massimiliano Mirra wrote: >> But it won't allow me to read unless I close_write it first, after >> which of course it is no longer possible to write to it, so the >> following will hange at the first gz.read: > > Have you considered using popen3 instead of popen? > > require 'open3' > in, out, err = Open3.popen3('ls -l') Unfortunately, popen3 uses fork, so it doesn't work on Windows. Dave Thomas writes: > Massimiliano Mirra writes: > >> Blocking to write output seems to be exactly what happens, yet it >> won't write if I don't close_write it first, which in turn prevents >> from writing more. This looks like a dog biting its tale. Maybe it's >> time to go back to the good ol' temp files. :-( > > Or multiple thread/processes (say fork the writer and read in the > parent) I wonder if you can use ruby threads for this. Hm...if so, I wonder if open3.rb should be re-written to use threads instead of Kernel::fork. -- matt