Parser: remove Readable proxied event for node 0.8

readable-stream proxies some events in wrap(). Since the Parser doesn't care about any events other than 'readable', we remove the troublesome proxied 'error' event.

Fixes #285
fork
Brian White 11 years ago
parent f139ce9842
commit 510aa0b7b9

@ -55,17 +55,14 @@ inherits(Parser, EventEmitter);
Parser.prototype.setStream = function(stream) { Parser.prototype.setStream = function(stream) {
if (/^v0\.8\./.test(process.version)) { if (/^v0\.8\./.test(process.version)) {
var newStream = new ReadableStream(), this._stream = (new ReadableStream()).wrap(stream);
wrapped = newStream.wrap(stream);
// as of now, 07/02/2013, the readable-stream module is behind in updates // since Readable.wrap() proxies events, we need to remove at least the
// and has different behavior for the return value of wrap() compared to // proxied 'error' event since this can cause problems and Parser doesn't
// node v0.10+, so we check for that here ... // care about such events
if (wrapped) stream._events.error.pop();
stream = wrapped; } else
else this._stream = stream;
stream = newStream;
}
this._stream = stream;
}; };
Parser.prototype._tryread = function(n) { Parser.prototype._tryread = function(n) {

@ -6,7 +6,7 @@
"dependencies": { "dependencies": {
"utf7": "1.0.0", "utf7": "1.0.0",
"iconv-lite": "0.2.11", "iconv-lite": "0.2.11",
"readable-stream": "1.0.2" "readable-stream": "1.0.15"
}, },
"scripts": { "scripts": {
"test": "node test/test.js" "test": "node test/test.js"

Loading…
Cancel
Save