From bfbbf260b491ff42cd4d0b4fa6a679eb706e9c2c Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Mon, 27 Dec 2021 11:46:55 -0500 Subject: [PATCH] fix instances of write_all without flush (#1001) * fix instances of write_all without flush * fix errors * Update byte_stream.rs Co-authored-by: Zelda Hessler --- aws/rust-runtime/aws-types/build.rs | 1 + aws/sdk/examples/kms/src/bin/encrypt.rs | 1 + aws/sdk/examples/kms/src/bin/reencrypt-data.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/aws/rust-runtime/aws-types/build.rs b/aws/rust-runtime/aws-types/build.rs index 267109076..82e4ef8a9 100644 --- a/aws/rust-runtime/aws-types/build.rs +++ b/aws/rust-runtime/aws-types/build.rs @@ -15,6 +15,7 @@ fn generate_build_vars(output_path: &Path) { .expect("Could not create build environment"); f.write_all(format!("const RUST_VERSION: &str = \"{}\";", rust_version).as_bytes()) .expect("Unable to write rust version"); + f.flush().expect("failed to flush"); } fn main() { diff --git a/aws/sdk/examples/kms/src/bin/encrypt.rs b/aws/sdk/examples/kms/src/bin/encrypt.rs index 25bfcfc43..f7d448214 100644 --- a/aws/sdk/examples/kms/src/bin/encrypt.rs +++ b/aws/sdk/examples/kms/src/bin/encrypt.rs @@ -83,6 +83,7 @@ async fn main() -> Result<(), Error> { let mut ofile = File::create(&out_file).expect("unable to create file"); ofile.write_all(s.as_bytes()).expect("unable to write"); + ofile.flush().expect("failed to flush"); if verbose { println!("Wrote the following to {:?}", out_file); diff --git a/aws/sdk/examples/kms/src/bin/reencrypt-data.rs b/aws/sdk/examples/kms/src/bin/reencrypt-data.rs index 3a7eaee86..ed70c473b 100644 --- a/aws/sdk/examples/kms/src/bin/reencrypt-data.rs +++ b/aws/sdk/examples/kms/src/bin/reencrypt-data.rs @@ -103,6 +103,7 @@ async fn main() -> Result<(), Error> { let mut ofile = File::create(o).expect("unable to create file"); ofile.write_all(s.as_bytes()).expect("unable to write"); + ofile.flush().expect("failed to flush"); if verbose { println!("Wrote the following to {}:", output_file); -- GitLab