Skip to content

Commit 11a5b35

Browse files
LiviaMedeirosaduh95
andcommitted
squash: fix race condition on closing fd
Co-authored-by: Antoine du Hamel <[email protected]>
1 parent f114cbb commit 11a5b35

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/parallel/test-fs-read-position-validation.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ async function testValid(position, allowedErrors = []) {
2020
const handler = common.mustCall((err) => {
2121
callCount--;
2222
if (err && !allowedErrors.includes(err.code)) {
23-
fs.close(fd, common.mustSucceed(() => reject(err)));
23+
fs.close(fd, common.mustSucceed());
24+
reject(err);
2425
} else if (callCount === 0) {
2526
fs.close(fd, common.mustSucceed(resolve));
2627
}

0 commit comments

Comments
 (0)