From: Robert Klemme Date: 2005-07-15T17:20:51+09:00 Subject: Re: Zlib::GzipWriter#close error Austin Ziegler wrote: > On 7/14/05, Gavin Kistner wrote: >> Why is Zlib::GzipWriter#close throwing an error here? The resulting >> file comes out as desired. > > I don't think that it's GZipWriter#close with the error. I think it's > the block form of File.open that's doing a close on out_file, which > may be already closed because you used GzipWriter#close. > > I had similar problems with Archive::Tar::Minitar. I think that > there's a different method for GzipWriter that will "finish" the > GzipWriter instance but not close the resulting stream. > > (rummage) > > Here it is. Change gz.close to gz.finish. > > -------------------------------------------------- > Zlib::GzipFile#finish finish() > ------------------------------------------------------------------------ > Closes the GzipFile object. Unlike Zlib::GzipFile#close, this > method never calls the close method of the associated IO object. > Returns the associated IO object. > > -austin Maybe the block form of GzipWriter#open is a solution, too... Zlib::GzipWriter.open('hoge.gz') do |gz| gz.write 'jugemu jugemu gokou no surikire...' endhttp://www.ruby-doc.org/stdlib/libdoc/zlib/rdoc/index.htmlKind regards robert