Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
zlib: emits 'close' event after readble 'end'
Call the close method after readable 'end' so that 'close' will be
emitted afterwards.

Fixes: #32023
  • Loading branch information
Sergey Zelenov committed Mar 2, 2020
commit 7cc5dcb4ddcfcb7c324d00839be601fc3cec9b27
2 changes: 1 addition & 1 deletion lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function ZlibBase(opts, mode, handle, { flush, finishFlush, fullFlush }) {
this._defaultFlushFlag = flush;
this._finishFlushFlag = finishFlush;
this._defaultFullFlushFlag = fullFlush;
this.once('end', _close.bind(null, this));
this.once('end', this.close);
this._info = opts && opts.info;
}
ObjectSetPrototypeOf(ZlibBase.prototype, Transform.prototype);
Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ zlib.createDeflateRaw({ windowBits: 8 });
.pipe(zlib.createInflateRaw({ windowBits: 8 }))
.on('data', (chunk) => reinflated.push(chunk))
.on('end', common.mustCall(
() => assert(Buffer.concat(raw).equals(Buffer.concat(reinflated)))));
() => assert(Buffer.concat(raw).equals(Buffer.concat(reinflated)))))
.on('close', common.mustCall(1));
}

// For each of the files, make sure that compressing and
Expand Down