-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.regressionIssues related to regressions.Issues related to regressions.
Description
I tried to find similar issues but couldn't, sorry if it is already reported.
- Version:
v14.11.0 - Platform:
Darwin MacBook-Pro-Daniil.local 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64
What steps will reproduce the bug?
With a+ flag file should be created if it does not exist. It works with readFileSync, but fails with readFile
There is also similar problem with w+ flag and maybe others, but I did not tested all of them.
const fs = require('fs');
const content = fs.readFileSync('./nonexistingfile1', {
encoding: 'utf-8',
flag: 'a+',
});
console.log(content); // content is empty string, so file was created
fs.readFile(
'./nonexistingfile2',
{ encoding: 'utf-8', flag: 'a+' },
(err, data) => {
console.log(err, data);
// [Error: ENOENT: no such file or directory, open './nonexistingfile2'] {
// errno: -2,
// code: 'ENOENT',
// syscall: 'open',
// path: './nonexistingfile2'
// }
}
);How often does it reproduce? Is there a required condition?
Always with node v14.11
Works fine in node v12.18.4
What is the expected behavior?
File is created before reading and there is no ENOENT error
What do you see instead?
ENOENT error
[Error: ENOENT: no such file or directory, open './nonexistingfile2'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: './nonexistingfile2'
}
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.regressionIssues related to regressions.Issues related to regressions.