Skip to content

Commit

Permalink
Flush atomic file writes
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Jan 9, 2022
1 parent 2026631 commit 5f55b5d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/utils.js
Expand Up @@ -231,4 +231,8 @@ function atomicWriteFileSync(filePath, contents) {
const stagingPath = filePath + '_';
fs.writeFileSync(stagingPath, contents);
fs.renameSync(stagingPath, filePath);
// It appears that on MacOS, it sometimes takes long for the file system to update
const file = fs.openSync(filePath);
fs.fsyncSync(file);
fs.closeSync(file);
}

0 comments on commit 5f55b5d

Please sign in to comment.