Skip to content

File::close(self) -> std::io::Result<()> for the std #353

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

Open
Byron opened this issue Mar 14, 2022 · 2 comments
Open

File::close(self) -> std::io::Result<()> for the std #353

Byron opened this issue Mar 14, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@Byron
Copy link
Member

Byron commented Mar 14, 2022

Gitoxide shouldn't rely on File::drop() after writing files as it squelches errors. Instead, use io-close but push for the ability to close files to be added to the standard library.

Creating a PR for it would be the way to go.

@EliahKagan
Copy link
Member

Are there places in gitoxide where the squelching of errors could be avoided, or meaningfully lessened, by doing an explicit flush before dropping a file that is open for write?

@Byron
Copy link
Member Author

Byron commented Dec 21, 2024

A quick search revealed that flush() is called in a couple of places already. It would also be a question if close() is necessarily flushing synchronously as well and thus would detect all possible errors - those related to flushing and those related to closing.
One might also think that flushing before closing (explicitly or implicitly) would always lure out errors related to the prior write.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants