Skip to content
Prev Previous commit
squash: fix race condition on closing fd
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
LiviaMedeiros and aduh95 committed May 15, 2022
commit 11a5b35bc63893bede0dc0fcd5de609a19c822d6
3 changes: 2 additions & 1 deletion test/parallel/test-fs-read-position-validation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ async function testValid(position, allowedErrors = []) {
const handler = common.mustCall((err) => {
callCount--;
if (err && !allowedErrors.includes(err.code)) {
fs.close(fd, common.mustSucceed(() => reject(err)));
fs.close(fd, common.mustSucceed());
reject(err);
} else if (callCount === 0) {
fs.close(fd, common.mustSucceed(resolve));
}
Expand Down