Skip to content

Commit cada22e

Browse files
Jungku LeeUlisesGascon
Jungku Lee
authored andcommitted
fs: fix to not return for void function
PR-URL: #50769 Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Qingyu Deng <[email protected]>
1 parent 158db2d commit cada22e

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

lib/fs.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ function close(fd, callback = defaultCloseCallback) {
534534
function closeSync(fd) {
535535
fd = getValidatedFd(fd);
536536

537-
return binding.close(fd);
537+
binding.close(fd);
538538
}
539539

540540
/**
@@ -784,7 +784,7 @@ function readv(fd, buffers, position, callback) {
784784
if (typeof position !== 'number')
785785
position = null;
786786

787-
return binding.readBuffers(fd, buffers, position, req);
787+
binding.readBuffers(fd, buffers, position, req);
788788
}
789789

790790
ObjectDefineProperty(readv, kCustomPromisifyArgsSymbol,
@@ -860,7 +860,8 @@ function write(fd, buffer, offsetOrOptions, length, position, callback) {
860860

861861
const req = new FSReqCallback();
862862
req.oncomplete = wrapper;
863-
return binding.writeBuffer(fd, buffer, offset, length, position, req);
863+
binding.writeBuffer(fd, buffer, offset, length, position, req);
864+
return;
864865
}
865866

866867
validateStringAfterArrayBufferView(buffer, 'buffer');
@@ -881,7 +882,7 @@ function write(fd, buffer, offsetOrOptions, length, position, callback) {
881882

882883
const req = new FSReqCallback();
883884
req.oncomplete = wrapper;
884-
return binding.writeString(fd, str, offset, length, req);
885+
binding.writeString(fd, str, offset, length, req);
885886
}
886887

887888
ObjectDefineProperty(write, kCustomPromisifyArgsSymbol,
@@ -971,7 +972,7 @@ function writev(fd, buffers, position, callback) {
971972
if (typeof position !== 'number')
972973
position = null;
973974

974-
return binding.writeBuffers(fd, buffers, position, req);
975+
binding.writeBuffers(fd, buffers, position, req);
975976
}
976977

977978
ObjectDefineProperty(writev, kCustomPromisifyArgsSymbol, {
@@ -1177,7 +1178,8 @@ function rmdir(path, options, callback) {
11771178
if (err === false) {
11781179
const req = new FSReqCallback();
11791180
req.oncomplete = callback;
1180-
return binding.rmdir(path, req);
1181+
binding.rmdir(path, req);
1182+
return;
11811183
}
11821184
if (err) {
11831185
return callback(err);
@@ -1190,7 +1192,7 @@ function rmdir(path, options, callback) {
11901192
validateRmdirOptions(options);
11911193
const req = new FSReqCallback();
11921194
req.oncomplete = callback;
1193-
return binding.rmdir(path, req);
1195+
binding.rmdir(path, req);
11941196
}
11951197
}
11961198

@@ -1296,7 +1298,7 @@ function fdatasync(fd, callback) {
12961298
*/
12971299
function fdatasyncSync(fd) {
12981300
fd = getValidatedFd(fd);
1299-
return binding.fdatasync(fd);
1301+
binding.fdatasync(fd);
13001302
}
13011303

13021304
/**
@@ -1321,7 +1323,7 @@ function fsync(fd, callback) {
13211323
*/
13221324
function fsyncSync(fd) {
13231325
fd = getValidatedFd(fd);
1324-
return binding.fsync(fd);
1326+
binding.fsync(fd);
13251327
}
13261328

13271329
/**
@@ -1888,7 +1890,7 @@ function unlink(path, callback) {
18881890
*/
18891891
function unlinkSync(path) {
18901892
path = pathModule.toNamespacedPath(getValidatedPath(path));
1891-
return binding.unlink(path);
1893+
binding.unlink(path);
18921894
}
18931895

18941896
/**
@@ -2929,7 +2931,7 @@ realpath.native = (path, options, callback) => {
29292931
path = getValidatedPath(path);
29302932
const req = new FSReqCallback();
29312933
req.oncomplete = callback;
2932-
return binding.realpath(pathModule.toNamespacedPath(path), options.encoding, req);
2934+
binding.realpath(pathModule.toNamespacedPath(path), options.encoding, req);
29332935
};
29342936

29352937
/**

0 commit comments

Comments
 (0)