Skip to content

Commit c3a27d1

Browse files
lpincaruyadorno
authored andcommitted
fs: remove unneeded return statement
The `writable._write()` implementation does not need to return anything, only call the callback. PR-URL: #48526 Reviewed-By: Keyhan Vakil <kvakil@sylph.kvakil.me> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
1 parent 3ae96ae commit c3a27d1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/internal/fs/sync_write_stream.js

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ ObjectSetPrototypeOf(SyncWriteStream, Writable);
2525
SyncWriteStream.prototype._write = function(chunk, encoding, cb) {
2626
writeSync(this.fd, chunk, 0, chunk.length);
2727
cb();
28-
return true;
2928
};
3029

3130
SyncWriteStream.prototype._destroy = function(err, cb) {

test/parallel/test-internal-fs-syncwritestream.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ const filename = path.join(tmpdir.path, 'sync-write-stream.txt');
3636
const stream = new SyncWriteStream(fd);
3737
const chunk = Buffer.from('foo');
3838

39-
assert.strictEqual(stream._write(chunk, null, common.mustCall(1)), true);
39+
let calledSynchronously = false;
40+
stream._write(chunk, null, common.mustCall(() => {
41+
calledSynchronously = true;
42+
}, 1));
43+
44+
assert.ok(calledSynchronously);
4045
assert.strictEqual(fs.readFileSync(filename).equals(chunk), true);
4146

4247
fs.closeSync(fd);

0 commit comments

Comments
 (0)