fix that js/file-system-race could have FPs related to loops

This commit is contained in:
erik-krogh
2022-10-11 13:41:51 +02:00
parent 02656b16c3
commit 7500a31814
2 changed files with 6 additions and 1 deletions

View File

@@ -41,3 +41,8 @@ const filePath3 = createFile();
if (fs.existsSync(filePath3)) {
fs.readFileSync(filePath3); // OK - a read after an existence check is OK
}
const filePath4 = createFile();
while(Math.random() > 0.5) {
fs.open(filePath4); // OK - it is only ever opened here.
}