[Slim:Sites/SVG/GFTraits] gavinkis% uname -a
Darwin Slim.local 8.2.0 Darwin Kernel Version 8.2.0: Fri Jun 24 17:46:54 PDT 2005; root:xnu-792.2.4.obj~3/RELEASE_PPC Power Macintosh powerpc
[Slim:Sites/SVG/GFTraits] gavinkis% ls *.svgz
GFTraits.svgz
Why is Zlib::GzipWriter#close throwing an error here? The resulting
file comes out as desired.
For now I've just thrown a rescue on the IOError and I'm happy, but
(based on the example in the Zlib documentation) I don't see what's
wrong here.
What happens if you uncomment the line gz.write...? As #result has access
to the current binding there's a chance that somewhere down the line
there's a gz.close() which would close the GzipWriter.
Other than that I don't have an idea either (apart from a bug).
robert
···
[Slim:Sites/SVG/GFTraits] gavinkis% ls *.svgz
tcsh: ls: No match.
[Slim:Sites/SVG/GFTraits] gavinkis% uname -a
Darwin Slim.local 8.2.0 Darwin Kernel Version 8.2.0: Fri Jun 24
17:46:54 PDT 2005; root:xnu-792.2.4.obj~3/RELEASE_PPC Power Macintosh
powerpc
[Slim:Sites/SVG/GFTraits] gavinkis% ls *.svgz
GFTraits.svgz
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.
On 7/14/05, Gavin Kistner <gavin@refinery.com> wrote:
Why is Zlib::GzipWriter#close throwing an error here? The resulting
file comes out as desired.
------------------------------------------------------------------------
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.
On 7/14/05, Gavin Kistner <gavin@refinery.com> 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
The error still occurs if I comment the line gz.write. (It was previously uncommented, so I assume that was a typo.)
···
On Jul 14, 2005, at 7:45 AM, Robert Klemme wrote:
What happens if you uncomment the line gz.write...? As #result has access
to the current binding there's a chance that somewhere down the line
there's a gz.close() which would close the GzipWriter.