• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const assert = require('assert');
4const fs = require('fs');
5
6// Test that using FileHandle.close to close an already-closed fd fails
7// with EBADF.
8
9(async function() {
10  const fh = await fs.promises.open(__filename);
11  fs.closeSync(fh.fd);
12
13  assert.rejects(() => fh.close(), {
14    code: 'EBADF',
15    syscall: 'close'
16  });
17})().then(common.mustCall());
18