Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nokogiri::XML::SAX file lock? #232

Closed
flavorjones opened this issue Feb 25, 2010 · 1 comment
Closed

Nokogiri::XML::SAX file lock? #232

flavorjones opened this issue Feb 25, 2010 · 1 comment

Comments

@flavorjones
Copy link
Member

Hi,

From the mailing list (Guillaume gjeudy@gmail.com):

I'm using nokogiri 1.4.1 on windows. I noticed that there is still a
system file handle lock after I've called
Nokogiri::XML::SAX::Parser:parse_file <file_name_string>. The file
handle is only closed when the ruby interpreter exits.

I tried Nokogiri::XML::SAX::Parser:parse_io but got the same behavior.
I had to use the below code to workaround the file handle leak:

file_handle = File.new(file_name)
begin
 parser.parse_io(file_handle)
ensure
 file_handle.close
end
@tenderlove
Copy link
Member

The file handle will be closed when the SAX parser context gets garbage collected. I don't think this is a bug.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants