Commit 1600966
fs: execute mkdtemp's callback with no context
All the callback functions in `fs` module are supposed to be executed
with no context (`this` value should not be a valid object). But
`mkdtemp`'s callback will have the `FSReqWrap` object as the context.
Sample code to reproduce the problem
'use strict';
const fs = require('fs');
fs.mkdtemp('/tmp/abcd', null, function() {
console.log(this);
});
This would print
FSReqWrap { oncomplete: [Function] }
But that should have printed `null` and this patch fixes that.
PR-URL: #7068
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent 2961f06 commit 1600966Copy full SHA for 1600966
File tree
Expand file treeCollapse file tree
2 files changed
+16
-9
lines changedOpen diff view settings
Filter options
- lib
- test/parallel
Expand file treeCollapse file tree
2 files changed
+16
-9
lines changedOpen diff view settings
Collapse file
+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1590 | 1590 | |
1591 | 1591 | |
1592 | 1592 | |
1593 | | - |
1594 | | - |
| 1593 | + |
1595 | 1594 | |
1596 | 1595 | |
1597 | 1596 | |
| ||
1605 | 1604 | |
1606 | 1605 | |
1607 | 1606 | |
| 1607 | + |
1608 | 1608 | |
1609 | 1609 | |
1610 | 1610 | |
|
Collapse file
test/parallel/test-fs-mkdtemp.js
Copy file name to clipboardExpand all lines: test/parallel/test-fs-mkdtemp.js+14-7Lines changed: 14 additions & 7 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
18 | 18 | |
19 | 19 | |
20 | 20 | |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
28 | 26 | |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
29 | 35 | |
| 36 | + |
0 commit comments