Skip to content

fs: WriteStream should handle partial writes

Rodrigo Muino Tomonari requested to merge github/fork/kyliau/writestream into master

Given a buffer of length l, fs.write() will not necessarily write the entire buffer to the file. This can occur if, for example, there is insufficient space on the underlying physical medium.

WriteStream did not handle this case, and when partial write occurs, it will errorneously report that the write is successful.

This commit changes the _write() behavior to continue the write operation, picking up from where the last operation left off.

More information about the write() system call is available at http://man7.org/linux/man-pages/man2/write.2.html

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading