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

Fixed undisposed writers in CSV saving #1248

Merged
merged 1 commit into from
Mar 29, 2019

Conversation

daniel-chambers
Copy link
Contributor

This fixes a small bug where the CSV Save functions don't dispose the writers they use, and therefore leave stream flushing and potentially file handles open until garbage collection cleans up the writers. I've simply changed the let writers to use writers to ensure they are disposed correctly.

One point that's worth some discussion: for the Save(stream : Stream ... overload, I've made it so that the save does not close the underlying stream. Instead, the writer flushes into it, but leaves it open. I chose to do this because I'm of the opinion that if I give a stream to something, I (the caller) own it and I will close and dispose it when I'm done with it. I don't expect Save to close and dispose it for me.
However this is not the default behaviour when you pass a Stream to a Writer, hence why I'm using a more complicated overload.

@dsyme
Copy link
Contributor

dsyme commented Mar 21, 2019

Close/open to re-run CI

@dsyme dsyme closed this Mar 21, 2019
@dsyme dsyme reopened this Mar 21, 2019
@dsyme dsyme merged commit e5f0492 into fsprojects:master Mar 29, 2019
@daniel-chambers daniel-chambers deleted the fix/csv-save-not-disposed branch March 31, 2019 03:34
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