[server] unpipe from the destination, prevent leaking listeners

This commit is contained in:
spalger 2015-11-06 14:57:40 -06:00
parent 79b1b0f151
commit 7a3784898a

View file

@ -21,12 +21,13 @@ module.exports = class KbnLogger {
}
init(readstream, emitter, callback) {
readstream
.pipe(this.squeeze)
.pipe(this.format)
.pipe(this.dest);
emitter.on('stop', _.noop);
this.output = readstream.pipe(this.squeeze).pipe(this.format);
this.output.pipe(this.dest);
emitter.on('stop', () => {
this.output.unpipe(this.dest);
});
callback();
}