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

Close the file after reading #7

Merged
merged 1 commit into from
Jul 17, 2022
Merged

Conversation

NobWow
Copy link
Contributor

@NobWow NobWow commented Jul 17, 2022

the file must be closed otherwise on Unix systems it creates an overflow

@appgurueu
Copy link
Owner

Technically garbage collection should eventually close the file:

Closes file. Note that files are automatically closed when their handles are garbage collected, but that takes an unpredictable amount of time to happen.

But it's definitely a code smell that I forgot to close it here, and as the reference manual states this can't be relied on.

Thanks for your PR!

@appgurueu appgurueu added the fix Fixes a bug label Jul 17, 2022
@appgurueu
Copy link
Owner

Now that I see what I'm doing there: I should probably have avoided this altogether by using io.lines.

@appgurueu appgurueu merged commit 9f65d5d into appgurueu:master Jul 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants