diff --git a/avm/src/lib.rs b/avm/src/lib.rs index 221c4172c2..398b5ce344 100644 --- a/avm/src/lib.rs +++ b/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();