GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: deflake test-filehandle-close · nodejs/node@5a615b0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-filehandle-close.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-filehandle-close.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-filehandle-close.js
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
// Flags: --expose-internals
12
'use strict';
23
const common = require('../common');
34
const assert = require('assert');
4-
const fs = require('fs');
5+
const { internalBinding } = require('internal/test/binding');
6+
const { FileHandle } = require('internal/fs/promises');
7+
const { FileHandle: NativeFileHandle } = internalBinding('fs');
58

6-
// Test that using FileHandle.close to close an already-closed fd fails
7-
// with EBADF.
9+
// Test that closing a FileHandle with an invalid fd fails with EBADF.
10+
// Use a high invalid fd so background I/O cannot reuse it before close runs.
811

912
(async function() {
10-
const fh = await fs.promises.open(__filename);
11-
fs.closeSync(fh.fd);
13+
const fh = common.runWithInvalidFD(
14+
(fd) => new FileHandle(new NativeFileHandle(fd)),
15+
);
1216

1317
await assert.rejects(() => fh.close(), {
1418
code: 'EBADF',

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.