1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-05-16 23:55: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:
michael-kerscher 2025-05-07 17:48:54 +02:00 committed by GitHub
parent 6da4ade59e
commit 479d834a10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) => {