Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
fixup! ensure cb behavior
  • Loading branch information
benjamingr committed Feb 11, 2022
commit 46c44a8ae989bd76087d00ce25a431e035819d24
2 changes: 1 addition & 1 deletion lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ function writev(fd, buffers, position, callback) {
callback = maybeCallback(callback || position);

if (buffers.length === 0) {
callback(null, 0, buffers);
process.nextTick(callback, null, 0, buffers);
return;
}

Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-fs-writev.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,17 @@ const getFileName = (i) => path.join(tmpdir.path, `writev_${i}.txt`);
const filename = getFileName(3);
const fd = fs.openSync(filename, 'w');
const bufferArr = [];
let afterSyncCall = false;

const done = common.mustSucceed((written, buffers) => {
assert.strictEqual(buffers.length, 0);
assert.strictEqual(written, 0);
assert(afterSyncCall);
fs.closeSync(fd);
});

fs.writev(fd, bufferArr, done);
afterSyncCall = true;
}

/**
Expand Down