From bbff7403fbf46f9ad92240ac213df8d30ef31b64 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Sep 2018 02:56:13 +0200 Subject: update packages --- node_modules/end-of-stream/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'node_modules/end-of-stream/index.js') 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); }; }; -- cgit v1.2.3