From edc0462470386957adf24d7c959e8143c19293ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Fri, 24 May 2019 17:06:47 +0200 Subject: [PATCH 1/2] Do not detach streams before finishing --- copy-to.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy-to.js b/copy-to.js index 557c55b..5b843d3 100644 --- a/copy-to.js +++ b/copy-to.js @@ -23,6 +23,7 @@ CopyStreamQuery.prototype.submit = function(connection) { connection.query(this.text) this.connection = connection this.connection.removeAllListeners('copyData') + this.on('end', () => this._detach()) connection.stream.pipe(this) } @@ -84,7 +85,6 @@ CopyStreamQuery.prototype._transform = function(chunk, enc, cb) { case code.ErrorResponse: case code.CopyDone: pushBufferIfneeded(); - this._detach() this.push(null) return cb(); break; From c865db412b420d93567227bfed43af3cb9d0be8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Fri, 24 May 2019 17:11:26 +0200 Subject: [PATCH 2/2] Update NEWS --- NEWS.carto.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.carto.md b/NEWS.carto.md index a6fc700..d7d0fe0 100644 --- a/NEWS.carto.md +++ b/NEWS.carto.md @@ -3,6 +3,9 @@ ## v2.2.0-carto.1 Released 2018-mm-dd +Bug fixes: + * Copy to: ensure stream is detached when finished + ## v1.2.0-carto.3 Released 2018-11-21