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

hClose not being called #459

Open
msrdic opened this issue Dec 16, 2020 · 2 comments
Open

hClose not being called #459

msrdic opened this issue Dec 16, 2020 · 2 comments

Comments

@msrdic
Copy link

msrdic commented Dec 16, 2020

Hi – I've discovered this one by mistakenly calling my tool in the wrong folder.

hClose is not being called after Language.Haskell.Exts.parseFile is done. It can result in too many files open error.

I've identified two places where file content is being read and hClose is not being called, the first one being the one described above, and the second one in a test runner (test/Runner.hs).

Steps to reproduce: the way I discovered this is by recursively calling parseFile on a complete source tree for the folder where I keep my source code.
Possible fix: I've verified in my own fork that a combination of a strict hGetContents and hClose works well. It can either be done by System.IO.Strict.hGetContents or by just copying this short implementation to keep the list of dependencies shorter.

I am happy to submit a pull request, assuming this is a valid issue and I am not completely off target or missing something.

@DanBurton
Copy link
Contributor

@msrdic This sounds reasonable to me. I would be happy to accept such a pull request.

@msrdic
Copy link
Author

msrdic commented Dec 23, 2020

@DanBurton it took a while, but it seems that CI passed successfully. This is a small change, but please advise if there's anything else that should be addressed (style, structure etc). Thanks.

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