aboutsummaryrefslogtreecommitdiff
path: root/node_modules/end-of-stream/index.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/end-of-stream/index.js
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/end-of-stream/index.js')
-rw-r--r--node_modules/end-of-stream/index.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/node_modules/end-of-stream/index.js b/node_modules/end-of-stream/index.js
index b3a906863..be426c227 100644
--- a/node_modules/end-of-stream/index.js
+++ b/node_modules/end-of-stream/index.js
@@ -39,6 +39,10 @@ var eos = function(stream, opts, callback) {
callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null);
};
+ var onerror = function(err) {
+ callback.call(stream, err);
+ };
+
var onclose = function() {
if (readable && !(rs && rs.ended)) return callback.call(stream, new Error('premature close'));
if (writable && !(ws && ws.ended)) return callback.call(stream, new Error('premature close'));
@@ -62,7 +66,7 @@ var eos = function(stream, opts, callback) {
stream.on('end', onend);
stream.on('finish', onfinish);
- if (opts.error !== false) stream.on('error', callback);
+ if (opts.error !== false) stream.on('error', onerror);
stream.on('close', onclose);
return function() {
@@ -75,7 +79,7 @@ var eos = function(stream, opts, callback) {
stream.removeListener('finish', onfinish);
stream.removeListener('exit', onexit);
stream.removeListener('end', onend);
- stream.removeListener('error', callback);
+ stream.removeListener('error', onerror);
stream.removeListener('close', onclose);
};
};