Skip to content
Snippets Groups Projects
Verified Commit 7277286e authored by Tom Almeida's avatar Tom Almeida
Browse files

Implement Drop for FILE, so we flush when the process exits

parent 81107f8c
No related branches found
No related tags found
No related merge requests found
...@@ -203,6 +203,15 @@ impl Read for FILE { ...@@ -203,6 +203,15 @@ impl Read for FILE {
} }
} }
impl Drop for FILE {
fn drop(&mut self) {
// Flush
if let Some(_) = self.write {
self.write(&[]);
}
}
}
/// Clears EOF and ERR indicators on a stream /// Clears EOF and ERR indicators on a stream
#[no_mangle] #[no_mangle]
pub extern "C" fn clearerr(stream: &mut FILE) { pub extern "C" fn clearerr(stream: &mut FILE) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment