From: Dave Thomas Date: 2002-03-12T23:42:15+09:00 Subject: Re: gzip again... Massimiliano Mirra writes: > I can't seem to process from within Ruby with gzip files that exceed a > certain (very) minimal size. > > > data = File.open('rdoc-alpha-c.tgz') {|f| f.read} > > 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 > works just fine. I'm clueless again and this time I'm not > sure it's something trivial. :-\ Any idea? My guess is that gzip is blocking waiting to write to you. Say you have a total of 100k to write to it, and that expands to 500k that it will send back to you. You're writing 100k in one chunk. gzip starts reading it, and after reading 50k it has enough data to start writing some output. Perhaps it has 200k to write to you. However, you're still busy writing, and don't yet have a read pending, so gzip will be suspended. The result is that both sides will be deadlocked. Dave