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

Ensure jsonfile is flushed before running post-run-command #305

Merged
merged 1 commit into from
Mar 29, 2023

Conversation

dnephin
Copy link
Member

@dnephin dnephin commented Feb 16, 2023

While discussing the proposal in #303 I noticed the jsonfile is closed after running the post-run-command. In some cases, I think it's possible the post-run-command would read the file before all the contents of the file are flushed.

The test added in this commit seems to pass without these extra Flush, but from what I can tell there's no guarantee the file is sycned to disk without these new calls. Maybe that test would flake occasionally without these new calls to Sync ?

The test seems to pass without these extra Flush, but from what I can
tell there's no guarantee the file is sycned to disk without these
new calls.
@dnephin dnephin merged commit 4ea330e into main Mar 29, 2023
@dnephin dnephin deleted the fix-jsonfile-close-order branch March 29, 2023 17:44
@dnephin dnephin restored the fix-jsonfile-close-order branch March 29, 2023 17:45
@dnephin dnephin deleted the fix-jsonfile-close-order branch March 29, 2023 17:45
@dnephin
Copy link
Member Author

dnephin commented Mar 29, 2023

Oh, this was working because https://stackoverflow.com/a/64093650/444646. At least on POSIX systems the sync isn't necessary.

Maybe this is necessary for windows? Either way I guess it doesn't hurt.

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