Skip to content

Commit cee16f1

Browse files
committed
fix: fix wrong promise rejection on some fs methods with no return value
fs.promises.readFile triggers a list of different calls, the last one is "close". The "close" call has no return value, so we cannot check the existence of "val" to determine successfulness. closes #278
1 parent fe97f3e commit cee16f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/binding.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function maybeCallback(callback, ctx, thisArg, func) {
6060
}
6161
return new Promise(function(resolve, reject) {
6262
process.nextTick(function() {
63-
if (val === undefined) {
63+
if (err) {
6464
reject(err);
6565
} else {
6666
resolve(val);

0 commit comments

Comments
 (0)