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
1 merge request!136Fixing some things in stdio
...@@ -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.
Please register or to comment