fixes lib/file.js write, it doesnt allways emit errors or success
authorOnne <onne@onnlucky.com>
Thu, 19 Nov 2009 18:12:42 +0000 (19:12 +0100)
committerRyan Dahl <ry@tinyclouds.org>
Thu, 19 Nov 2009 18:12:42 +0000 (19:12 +0100)
lib/file.js

index 84a09a8..fdb7e25 100644 (file)
@@ -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));
             }