diff --git a/lib/internal/fs/sync_write_stream.js b/lib/internal/fs/sync_write_stream.js index 8fa5c56aaffc62..5fff43f43a76c9 100644 --- a/lib/internal/fs/sync_write_stream.js +++ b/lib/internal/fs/sync_write_stream.js @@ -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) { diff --git a/test/parallel/test-internal-fs-syncwritestream.js b/test/parallel/test-internal-fs-syncwritestream.js index bafa5fd8f4624f..b93d3f01d875ee 100644 --- a/test/parallel/test-internal-fs-syncwritestream.js +++ b/test/parallel/test-internal-fs-syncwritestream.js @@ -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);