Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2249234

Browse filesBrowse files
committed
fs: invoke callbacks with undefined context
Many callbacks appear to be invoked with `this` set to `undefined` including `fs.stat()`, `fs.lstat()`, and `fs.fstat()`. However, some such as `fs.open()` and `fs.mkdtemp()` invoke their callbacks with `this` set to `null`. Change to `undefined`. PR-URL: #14645 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
1 parent c6126b1 commit 2249234
Copy full SHA for 2249234

File tree

Expand file treeCollapse file tree

3 files changed

+3
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+3
-3
lines changed
Open diff view settings
Collapse file

‎lib/fs.js‎

Copy file name to clipboardExpand all lines: lib/fs.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function makeCallback(cb) {
132132
}
133133

134134
return function() {
135-
return cb.apply(null, arguments);
135+
return cb.apply(undefined, arguments);
136136
};
137137
}
138138

Collapse file

‎test/parallel/test-fs-mkdtemp.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-mkdtemp.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ assert(common.fileExists(utf8));
2020
function handler(err, folder) {
2121
assert.ifError(err);
2222
assert(common.fileExists(folder));
23-
assert.strictEqual(this, null);
23+
assert.strictEqual(this, undefined);
2424
}
2525

2626
fs.mkdtemp(path.join(common.tmpDir, 'bar.'), common.mustCall(handler));
Collapse file

‎test/parallel/test-fs-stat.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-stat.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fs.open('.', 'r', undefined, common.mustCall(function(err, fd) {
6666
// Confirm that we are not running in the context of the internal binding
6767
// layer.
6868
// Ref: https://github.com/nodejs/node/commit/463d6bac8b349acc462d345a6e298a76f7d06fb1
69-
assert.strictEqual(this, null);
69+
assert.strictEqual(this, undefined);
7070
}));
7171

7272
// fstatSync

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.