From 58bcb64c1982c71cf26f79c81b67703bfc442050 Mon Sep 17 00:00:00 2001 From: Richer <32590310+richerfu@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:16:00 +0800 Subject: [PATCH] fix(napi-derive): call flush on the BufWriter (#2242) --- crates/macro/src/expand/napi.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/macro/src/expand/napi.rs b/crates/macro/src/expand/napi.rs index 608321bc..5e15c553 100644 --- a/crates/macro/src/expand/napi.rs +++ b/crates/macro/src/expand/napi.rs @@ -130,7 +130,8 @@ fn output_wasi_register_def(napi: &Napi) { let mut writer = BufWriter::::new(file); let pkg_name: String = std::env::var("CARGO_PKG_NAME").expect("CARGO_PKG_NAME is not set"); writer.write_all(format!("{pkg_name}: {}", napi.register_name()).as_bytes())?; - writer.write_all("\n".as_bytes()) + writer.write_all("\n".as_bytes())?; + writer.flush() }) .unwrap_or_else(|e| { println!("Failed to write wasi register file: {:?}", e);