mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-16 15:45:42 +02:00
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
This commit is contained in:
parent
6da4ade59e
commit
479d834a10
@ -58,7 +58,7 @@ pub fn process(output_directory: &Path, input_contents: &str) -> anyhow::Result<
|
||||
Event::Text(text) => {
|
||||
info!("Text: {:?}", text);
|
||||
if let Some(output_file) = &mut current_file {
|
||||
output_file.write(text.as_bytes())?;
|
||||
output_file.write_all(text.as_bytes())?;
|
||||
}
|
||||
}
|
||||
Event::End(TagEnd::CodeBlock) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user