Skip to content

Commit

Permalink
test: close fds properly in tests
Browse files Browse the repository at this point in the history
Otherwise the unclosed fd may keep the file open which makes
subsequent rmdir attempts failed at exit.
  • Loading branch information
joyeecheung committed Jun 1, 2021
1 parent a4ea9fc commit 91f6965
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/parallel/test-fs-writefile-with-fd.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ tmpdir.refresh();

fs.open(file, 'r', common.mustSucceed((fd) => {
fs.writeFile(fd, 'World', common.expectsError(expectedError));
fs.closeSync(fd);
}));
}

Expand All @@ -79,6 +80,7 @@ tmpdir.refresh();
fs.writeFile(fd, 'World', { signal }, common.expectsError({
name: 'AbortError'
}));
fs.closeSync(fd);
}));

controller.abort();
Expand Down

0 comments on commit 91f6965

Please sign in to comment.