Skip to content

Commit 479d834

Browse files
mdbook-exerciser: ensure all code block bytes of the examples are written to the file (#2742)
- write() attempts to write the entire buffer does not guarantee this. Not writing all bytes is not considered an error. It just returns the number of bytes. - write_all() ensures that everything is written or throws an error
1 parent 6da4ade commit 479d834

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mdbook-exerciser/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub fn process(output_directory: &Path, input_contents: &str) -> anyhow::Result<
5858
Event::Text(text) => {
5959
info!("Text: {:?}", text);
6060
if let Some(output_file) = &mut current_file {
61-
output_file.write(text.as_bytes())?;
61+
output_file.write_all(text.as_bytes())?;
6262
}
6363
}
6464
Event::End(TagEnd::CodeBlock) => {

0 commit comments

Comments
 (0)