From c3eb3efa315382d1073d6a126f4d888cf3e121ec Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Fri, 9 Feb 2018 16:31:26 +0100 Subject: fs: fix functions executed in wrong context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The callback should run in the global scope and not in the FSReqWrap context. PR-URL: https://github.com/nodejs/node/pull/18668 Refs: https://github.com/nodejs/node/pull/12562 Refs: https://github.com/nodejs/node/pull/12976 Reviewed-By: Matteo Collina Reviewed-By: Michaƫl Zasso Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Joyee Cheung Reviewed-By: Gus Caplan --- lib/fs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/fs.js') diff --git a/lib/fs.js b/lib/fs.js index abffde7b9e..543e6b8c61 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -737,7 +737,7 @@ fs.ftruncateSync = function(fd, len = 0) { }; fs.rmdir = function(path, callback) { - callback = maybeCallback(callback); + callback = makeCallback(callback); path = getPathFromURL(path); validatePath(path); const req = new FSReqWrap(); @@ -1784,7 +1784,7 @@ fs.realpath = function realpath(p, options, callback) { fs.realpath.native = function(path, options, callback) { - callback = maybeCallback(callback || options); + callback = makeCallback(callback || options); options = getOptions(options, {}); path = getPathFromURL(path); validatePath(path); -- cgit v1.2.3