Skip to content

Commit 0b89724

Browse files
committed
tweak comment and use a weaker fence
1 parent bd20e26 commit 0b89724

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/pass-dep/tokio/file-io.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ async fn test_create_and_write() -> io::Result<()> {
2121

2222
// Write 10 bytes to the file.
2323
file.write_all(b"some bytes").await?;
24-
file.sync_all().await?; // tokio doesn't necessarily complete writes until you sync.
24+
// For tokio's file I/O, `await` does not have its usual semantics of waiting until the
25+
// operation is completed, so we have to wait some more to make sure the write is completed.
26+
file.flish().await?;
27+
// Check that 10 bytes have been written.
2528
assert_eq!(file.metadata().await.unwrap().len(), 10);
2629

2730
remove_file(&path).unwrap();

0 commit comments

Comments
 (0)