Closed campbellr closed 7 years ago
You are right, a.stream should be closed if open() doesn't find valid archive. I can fix that later today, PR would be also great, thanks!
Awesome, thanks for this (and the library in general)!
No problem. Glad you've found the package useful.
The example in the README shows:
I found out the hard way that this ends up leaking file descriptors, which was unexpected (to me). I had assumed that if
NewArchive
there would be no need to callClose
. (that is, for example, howarchive/zip.OpenReader
behaves)Looking through the code, the fd returned by
C.ar_open_file(p)
is created but not cleaned ifa.open
fails.Is this expected behavior? If so, it would be helpful to update the docs. If not,
a.stream
should probably be closed ifa.open
fails`I would be happy to submit a PR for either.