From 325208247428723f45f2db36c7a1f14f9d558a2b Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 25 May 2020 13:20:29 -0500 Subject: [PATCH] Fix test on Windows hosts FlushFileBuffers requires that a file be opened for writing --- tests/run-pass/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-pass/fs.rs b/tests/run-pass/fs.rs index d831129dc80..a031233d581 100644 --- a/tests/run-pass/fs.rs +++ b/tests/run-pass/fs.rs @@ -188,7 +188,7 @@ fn test_file_sync() { let path = prepare_with_content("miri_test_fs_sync.txt", bytes); // Test that we can call sync_data and sync_all (can't readily test effects of this operation) - let file = File::open(&path).unwrap(); + let file = OpenOptions::new().write(true).open(&path).unwrap(); file.sync_data().unwrap(); file.sync_all().unwrap();