Skip to content

Commit b9bb83f

Browse files
authored
fix(fs): flush RealFs append to prevent data loss race (#586)
## Summary - Adds `file.flush().await?` after `write_all` in `RealFs::append` to ensure data is persisted before the file handle is dropped - Fixes flaky `readwrite_mount_modifies_host` test that fails in CI due to tokio's internal buffering — `write_all` returns `Ready` before the blocking write completes, so without flush the data can be lost on drop ## Test plan - [x] `cargo test --features realfs -p bashkit --test realfs_tests readwrite_mount_modifies_host` passes - [x] `cargo test --all-features --tests` passes - [x] `cargo clippy --all-targets --all-features -- -D warnings` clean - [ ] CI green
1 parent 73f99bc commit b9bb83f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

crates/bashkit/src/fs/realfs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ impl FsBackend for RealFs {
293293
.open(&real)
294294
.await?;
295295
file.write_all(content).await?;
296+
file.flush().await?;
296297
Ok(())
297298
}
298299

0 commit comments

Comments
 (0)