-
Notifications
You must be signed in to change notification settings - Fork 2
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
Flushing doesn't work #217
Labels
bug
Something isn't working
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would expect this test to pass:
But it does not.
To actually flush data to the writer, Csv.Writer.Output::flush must be called. But this is only called when the buffer is full, or the output is closed. In particular, Csv.Writer::flush does not call it.
I would also expect this to pass if the StringWriter was wrapped in a BufferedWriter with a very large buffer. That is, Csv.Writer::flush should call Writer::flush, not just write the contents of the internal buffer.
I have a long-running process which slowly writes to a CSV-formatted file. That file is consumed by other processes. It would be very useful to be able to ensure that lines are actually written to the file long before it is closed.
The workaround is to use a disposable Csv.Writer for each line - closing it at the end of the line flushes the buffer.
The text was updated successfully, but these errors were encountered: