diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 6c4d95e5b..54ceaa102 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -545,6 +545,7 @@ function emitDataEvents(stream, startPaused) { stream.on('readable', function() { readable = true; + var c; while (!paused && (null !== (c = stream.read()))) stream.emit('data', c); @@ -562,7 +563,9 @@ function emitDataEvents(stream, startPaused) { stream.resume = function() { paused = false; if (readable) - stream.emit('readable'); + process.nextTick(function() { + stream.emit('readable'); + }); }; // now make it start, just in case it hadn't already.