Browse Source

fixup! avm: force file sync (#1457) (#1460)

steviez 3 years ago
parent
commit
727a5a166c
1 changed files with 3 additions and 0 deletions
  1. 3 0
      avm/src/lib.rs

+ 3 - 0
avm/src/lib.rs

@@ -281,6 +281,9 @@ mod tests {
         let mut current_version_file =
             fs::File::create(current_version_file_path().as_path()).unwrap();
         current_version_file.write_all("0.18.2".as_bytes()).unwrap();
+        // Sync the file to disk before the read in current_version() to
+        // mitigate the read not seeing the written version bytes.
+        current_version_file.sync_all().unwrap();
         // Create a fake binary for anchor-0.18.2 in the bin directory
         fs::File::create(version_binary_path(&version)).unwrap();
         uninstall_version(&version).unwrap();