Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs: fix to not return for void function #50769

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ function close(fd, callback = defaultCloseCallback) {
function closeSync(fd) {
fd = getValidatedFd(fd);

return binding.close(fd);
binding.close(fd);
}

/**
Expand Down Expand Up @@ -782,7 +782,7 @@ function readv(fd, buffers, position, callback) {
if (typeof position !== 'number')
position = null;

return binding.readBuffers(fd, buffers, position, req);
binding.readBuffers(fd, buffers, position, req);
}

ObjectDefineProperty(readv, kCustomPromisifyArgsSymbol,
Expand Down Expand Up @@ -858,7 +858,8 @@ function write(fd, buffer, offsetOrOptions, length, position, callback) {

const req = new FSReqCallback();
req.oncomplete = wrapper;
return binding.writeBuffer(fd, buffer, offset, length, position, req);
binding.writeBuffer(fd, buffer, offset, length, position, req);
return;
}

validateStringAfterArrayBufferView(buffer, 'buffer');
Expand All @@ -879,7 +880,7 @@ function write(fd, buffer, offsetOrOptions, length, position, callback) {

const req = new FSReqCallback();
req.oncomplete = wrapper;
return binding.writeString(fd, str, offset, length, req);
binding.writeString(fd, str, offset, length, req);
}

ObjectDefineProperty(write, kCustomPromisifyArgsSymbol,
Expand Down Expand Up @@ -969,7 +970,7 @@ function writev(fd, buffers, position, callback) {
if (typeof position !== 'number')
position = null;

return binding.writeBuffers(fd, buffers, position, req);
binding.writeBuffers(fd, buffers, position, req);
}

ObjectDefineProperty(writev, kCustomPromisifyArgsSymbol, {
Expand Down Expand Up @@ -1175,7 +1176,8 @@ function rmdir(path, options, callback) {
if (err === false) {
const req = new FSReqCallback();
req.oncomplete = callback;
return binding.rmdir(path, req);
binding.rmdir(path, req);
return;
}
if (err) {
return callback(err);
Expand All @@ -1188,7 +1190,7 @@ function rmdir(path, options, callback) {
validateRmdirOptions(options);
const req = new FSReqCallback();
req.oncomplete = callback;
return binding.rmdir(path, req);
binding.rmdir(path, req);
}
}

Expand Down Expand Up @@ -1294,7 +1296,7 @@ function fdatasync(fd, callback) {
*/
function fdatasyncSync(fd) {
fd = getValidatedFd(fd);
return binding.fdatasync(fd);
binding.fdatasync(fd);
}

/**
Expand All @@ -1319,7 +1321,7 @@ function fsync(fd, callback) {
*/
function fsyncSync(fd) {
fd = getValidatedFd(fd);
return binding.fsync(fd);
binding.fsync(fd);
}

/**
Expand Down Expand Up @@ -1868,7 +1870,7 @@ function unlink(path, callback) {
*/
function unlinkSync(path) {
path = pathModule.toNamespacedPath(getValidatedPath(path));
return binding.unlink(path);
binding.unlink(path);
}

/**
Expand Down Expand Up @@ -2909,7 +2911,7 @@ realpath.native = (path, options, callback) => {
path = getValidatedPath(path);
const req = new FSReqCallback();
req.oncomplete = callback;
return binding.realpath(pathModule.toNamespacedPath(path), options.encoding, req);
binding.realpath(pathModule.toNamespacedPath(path), options.encoding, req);
};

/**
Expand Down