mirror of
https://github.com/nodejs/node.git
synced 2025-05-13 21:16:45 +00:00

Fixes: https://github.com/nodejs/node/issues/31202 PR-URL: https://github.com/nodejs/node/pull/31276 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
18 lines
406 B
JavaScript
18 lines
406 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
|
|
// Test that using FileHandle.close to close an already-closed fd fails
|
|
// with EBADF.
|
|
|
|
(async function() {
|
|
const fh = await fs.promises.open(__filename);
|
|
fs.closeSync(fh.fd);
|
|
|
|
assert.rejects(() => fh.close(), {
|
|
code: 'EBADF',
|
|
syscall: 'close'
|
|
});
|
|
})().then(common.mustCall());
|