From 502c6b221f12a3696ea33c44ddb101c60f140c7d Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Wed, 6 Nov 2024 09:35:47 -0500 Subject: [PATCH] fix(core): revert archive file creation changes --- .../nx/src/native/workspace/files_archive.rs | 31 ++----------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/packages/nx/src/native/workspace/files_archive.rs b/packages/nx/src/native/workspace/files_archive.rs index 453b02b1bed1c..eaea136e97d60 100644 --- a/packages/nx/src/native/workspace/files_archive.rs +++ b/packages/nx/src/native/workspace/files_archive.rs @@ -73,41 +73,16 @@ pub fn read_files_archive>(cache_dir: P) -> Option pub fn write_files_archive>(cache_dir: P, files: NxFileHashes) { let now = std::time::Instant::now(); let archive_path = cache_dir.as_ref().join(NX_FILES_ARCHIVE); - let archive_path_temp = - cache_dir - .as_ref() - .join(format!("{}.{}", NX_FILES_ARCHIVE, std::process::id())); - - std::fs::create_dir_all(&cache_dir) - .inspect_err(|e| { - trace!("Error creating cache directory: {:?}", e); - }) - .ok(); - let result = rkyv::to_bytes::<_, 2048>(&files) .map_err(anyhow::Error::from) .and_then(|encoded| { - std::fs::write(&archive_path_temp, encoded).map_err(|e| { - anyhow::anyhow!( - "Unable to write to {}: {:?}", - &archive_path_temp.display(), - e - ) - }) - }) - .and_then(|_| { - std::fs::rename(&archive_path_temp, &archive_path).map_err(|e| { - anyhow::anyhow!( - "unable to move temp archive file to {}: {:?}", - &archive_path.display(), - e - ) - }) + std::fs::write(archive_path, encoded)?; + Ok(()) }); match result { Ok(_) => { - trace!("wrote archive in {:?}", now.elapsed()); + trace!("write archive in {:?}", now.elapsed()); } Err(e) => { trace!("could not write files archive: {:?}", e);