mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
fs: remove unneeded return statement
The `writable._write()` implementation does not need to return anything, only call the callback. PR-URL: https://github.com/nodejs/node/pull/48526 Reviewed-By: Keyhan Vakil <kvakil@sylph.kvakil.me> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
This commit is contained in:
parent
7202859402
commit
d09ff0db70
@ -25,7 +25,6 @@ ObjectSetPrototypeOf(SyncWriteStream, Writable);
|
||||
SyncWriteStream.prototype._write = function(chunk, encoding, cb) {
|
||||
writeSync(this.fd, chunk, 0, chunk.length);
|
||||
cb();
|
||||
return true;
|
||||
};
|
||||
|
||||
SyncWriteStream.prototype._destroy = function(err, cb) {
|
||||
|
@ -36,7 +36,12 @@ const filename = path.join(tmpdir.path, 'sync-write-stream.txt');
|
||||
const stream = new SyncWriteStream(fd);
|
||||
const chunk = Buffer.from('foo');
|
||||
|
||||
assert.strictEqual(stream._write(chunk, null, common.mustCall(1)), true);
|
||||
let calledSynchronously = false;
|
||||
stream._write(chunk, null, common.mustCall(() => {
|
||||
calledSynchronously = true;
|
||||
}, 1));
|
||||
|
||||
assert.ok(calledSynchronously);
|
||||
assert.strictEqual(fs.readFileSync(filename).equals(chunk), true);
|
||||
|
||||
fs.closeSync(fd);
|
||||
|
Loading…
Reference in New Issue
Block a user