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 — fs: add missing HandleScope to FileHandle.close · nodejs/node@b55fba2

File tree

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

‎src/node_file.cc‎

Copy file name to clipboardExpand all lines: src/node_file.cc
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ MaybeLocal<Promise> FileHandle::ClosePromise() {
301301
close->file_handle()->AfterClose();
302302
Isolate* isolate = close->env()->isolate();
303303
if (req->result < 0) {
304+
HandleScope handle_scope(isolate);
304305
close->Reject(UVException(isolate, req->result, "close"));
305306
} else {
306307
close->Resolve();
Collapse file

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

Copy file name to clipboard
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict';
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const 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());

0 commit comments

Comments
0 (0)
You are visitor 01402503 — 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.