-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fs: fix not found
close
creation context
- Loading branch information
Showing
2 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
|
||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
// This test runs `fs.readFile` which calls ReadFileContext | ||
// that triggers binding.close() when read operation is done. | ||
// The goal of this test is to not crash | ||
let val; | ||
|
||
// For loop is required to trigger fast API. | ||
for (let i = 0; i < 100_000; i++) { | ||
try { | ||
val = fs.readFile(path.join(__dirname, './test-fs-close.js'), (a, b) => { | ||
assert.strictEqual(a, null); | ||
Check failure on line 18 in test/parallel/test-fs-close-fast-api.js GitHub Actions / test-linux
Check failure on line 18 in test/parallel/test-fs-close-fast-api.js GitHub Actions / test-macOS
|
||
assert.ok(b.length > 0); | ||
}); | ||
} catch { | ||
// do nothing | ||
} | ||
|
||
} | ||
|
||
console.log(val); |