mirror of
https://github.com/napi-rs/napi-rs.git
synced 2025-12-08 19:56:07 +00:00
fix(napi-derive): call flush on the BufWriter (#2195)
This is mandated by the Rust doc of the BufWriter. We've also seen bugs where the data doesn't seem to be flushed properly, and thus the CLI fails to parse JSONs emitted by napi-derive. This might be it, or not, but flushing shouldn't hurt.
This commit is contained in:
parent
0adb1a4992
commit
f88b90f71e
@ -149,7 +149,8 @@ fn output_type_def(napi: &Napi) {
|
||||
.and_then(|file| {
|
||||
let mut writer = BufWriter::<fs::File>::new(file);
|
||||
writer.write_all(type_def.to_string().as_bytes())?;
|
||||
writer.write_all("\n".as_bytes())
|
||||
writer.write_all("\n".as_bytes())?;
|
||||
writer.flush()
|
||||
})
|
||||
.unwrap_or_else(|e| {
|
||||
println!("Failed to write type def file: {:?}", e);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user