From: Massimiliano Mirra Date: 2002-03-13T02:04:19+09:00 Subject: Re: gzip again... On Tue, Mar 12, 2002 at 11:13:35PM +0900, Paul Brannan wrote: > > IO.popen('gzip -dc', 'w+') do |gz| > > gz.syswrite(data) > > gz.close_write > > end > > The above code just hangs everything. From a console, gzip -dc > Look at the return value from syswrite(). It may not be writing all the > bytes at once; Yes, you're right. I checked it and it hangs if I tell it to slurp more than the first 36864 bytes at once. > you may want to use a loop and slice! to write the rest > of the data that didn't get written. 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: IO.popen('gzip -dc', 'w+') do |gz| gz.syswrite(data[0...36864]) gz.read gz.syswrite(data[36864...40000]) gz.read end Massimiliano