From 523f1b98b8419bc6e1a256ec185fea7f30322888 Mon Sep 17 00:00:00 2001 From: Livia Medeiros <74449973+LiviaMedeiros@users.noreply.github.com> Date: Mon, 9 May 2022 20:10:20 +0800 Subject: [PATCH] squash: fix race condition on closing fd Co-authored-by: Antoine du Hamel --- test/parallel/test-fs-read-position-validation.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-fs-read-position-validation.mjs b/test/parallel/test-fs-read-position-validation.mjs index 10be65bfafd6535..919a8dd14199038 100644 --- a/test/parallel/test-fs-read-position-validation.mjs +++ b/test/parallel/test-fs-read-position-validation.mjs @@ -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)); }