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 file after write #695

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

averater
Copy link
Contributor

This commit is to avoid keeping the log file open when not needed. That is helpful if it is a gz file as it then can be copied without being truncated. If the file is copied at the very same time as it is being written to it will still be truncated, but with this commit that risk is smaller.

This commit is to avoid keeping the log file open when not needed.
That is helpful if it is a gz file as it then can be copied without
being truncated. If the file is copied at the very same time as it
is being written to it will still be truncated, but with this commit
that risk is smaller.
@averater
Copy link
Contributor Author

This commit changes the write flow from:
Close file if open
Open file
Write to file

New flow:
Close file if open
Open file
Write to file
Close file

I am not sure if either is very good. The latter seem better to me but perhaps should the file not be closed at all unless needed.

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.

1 participant