fixes lib/file.js write, it doesnt allways emit errors or success
This commit is contained in:
parent
686bec4f35
commit
9d39e18c6d
@ -29,10 +29,12 @@ exports.write = function (filename, data, encoding) {
|
||||
posix.write(fd, _data, 0, encoding)
|
||||
.addErrback(function () {
|
||||
posix.close(fd);
|
||||
promise.emitError();
|
||||
})
|
||||
.addCallback(function (written) {
|
||||
if (written === _data.length) {
|
||||
posix.close(fd);
|
||||
promise.emitSuccess();
|
||||
} else {
|
||||
doWrite(_data.slice(written));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user