You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fs.writeSync(fd, buf, 0, buf.length); should work; right now, fs.writeSync always uses the length argument, even when it’s undefined. I doubt that’s intentional, though.
I don't think it will in its current state, no. I'm on holiday for the next week, but will make sure to pick it up if noone else has landed a fix in the mean time. It's weird, seems like this bug has been there since at least 0.6. It really is the most basic form of fs.write(Sync) -- and now the two of us both discover it within half a week :)
// Wrapper for write(2).
//
// bytesWritten = write(fd, buffer, offset, length, position, callback)
// 0 fd integer. file descriptor
// 1 buffer the data to write
// 2 offset where in the buffer to start from if integer, 0 if undefined or null
// 3 length how much to write if integer, buffer length minus offset if undefined or null
// 4 position if integer, position to write at in the file.
// if null or undefined, write from the current position
As I understand WriteBuffer is common meeting point for all write and writeSync functions. Thos functions could be simplified after WriteBuffer gets new functionality.
Activity
saghul commentedon Jul 26, 2016
The
writeSynccall returns 0, which means no data was written. Didn't have time to investigate further.addaleax commentedon Jul 26, 2016
fs.writeSync(fd, buf, 0, buf.length);should work; right now,fs.writeSyncalways uses thelengthargument, even when it’sundefined. I doubt that’s intentional, though.papandreou commentedon Jul 26, 2016
Sounds like you've run into the same problem for
writeSyncas I did withwritea few days ago: #7856gracjan commentedon Jul 26, 2016
@papandreou: looks alike. Will the fix there also fix my issue?
papandreou commentedon Jul 26, 2016
I don't think it will in its current state, no. I'm on holiday for the next week, but will make sure to pick it up if noone else has landed a fix in the mean time. It's weird, seems like this bug has been there since at least 0.6. It really is the most basic form of
fs.write(Sync)-- and now the two of us both discover it within half a week :)gracjan commentedon Jul 26, 2016
@papandreou, alternatevly you could change this here
node/src/node_file.cc
Line 1001 in c86c1ee
WriteBufferaccepts the following spec:As I understand
WriteBufferis common meeting point for allwriteandwriteSyncfunctions. Thos functions could be simplified afterWriteBuffergets new functionality.papandreou commentedon Dec 27, 2016
Fixed by #7856 (released in 7.2.0). This issue can be closed now.