diff options
author | Trevor Norris <trev.norris@gmail.com> | 2014-01-04 03:03:11 -0800 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2014-01-04 23:08:36 -0800 |
commit | 22f32d63832d533336c25557fefde5dee2943d4c (patch) | |
tree | 88973d14df739d14bf29b95ab03c89868b30dc7b | |
parent | 3f2cfe1762856ac1a6cf5872de33d5f121937b8f (diff) | |
download | node-run-in-closing-handles.tar.gz |
zlib: emit after properly closedrun-in-closing-handles
-rw-r--r-- | lib/zlib.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/zlib.js b/lib/zlib.js index 3341588e4..efa0f19b0 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -191,8 +191,9 @@ function zlibBuffer(engine, buffer, callback) { function onEnd() { var buf = Buffer.concat(buffers, nread); buffers = []; - callback(null, buf); - engine.close(); + engine.close(function() { + callback(null, buf); + }); } } @@ -421,10 +422,8 @@ Zlib.prototype.close = function(callback) { this._closed = true; - this._binding.close(); - var self = this; - process.nextTick(function() { + this._binding.close(function() { self.emit('close'); }); }; |