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

Fix issue with not closed file descriptor #29

Merged
merged 2 commits into from
Nov 16, 2023
Merged

Fix issue with not closed file descriptor #29

merged 2 commits into from
Nov 16, 2023

Conversation

berejant
Copy link
Contributor

#28

Comment on lines +353 to +358
func (p *Parser) Close() (err error) {
if p.file != nil {
err = p.file.Close()
}
return err
}
Copy link
Contributor Author

@berejant berejant Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

provide interface to Close parser (for case when Parse was not closed; useful to use like
defer parser.Close())

FilePath: p.lexer.file, //TODO: set filepath here,
Block: p.parseBlock(),
}
_ = p.Close()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buffer was read at this point, so it's time to close file.

@tufanbarisyildirim
Copy link
Owner

Thanks for the contribution @berejant!

@tufanbarisyildirim tufanbarisyildirim merged commit 5dd06bb into tufanbarisyildirim:master Nov 16, 2023
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants