Browse Source

streams2: Call read(0) on resume()

Otherwise (especially with stdin) you sometimes end up in cases
where the high water mark is zero, and the current buffer is at 0,
and it doesn't need a readable event, so it never calls _read().
v0.9.4-release
isaacs 12 years ago
parent
commit
8f428f3b0d
  1. 2
      lib/_debugger.js
  2. 3
      lib/_stream_readable.js

2
lib/_debugger.js

@ -36,7 +36,7 @@ exports.start = function(argv, stdin, stdout) {
}
// Setup input/output streams
stdin = stdin || process.openStdin();
stdin = stdin || process.stdin;
stdout = stdout || process.stdout;
var args = ['--debug-brk'].concat(argv),

3
lib/_stream_readable.js

@ -521,6 +521,7 @@ Readable.prototype.addListener = Readable.prototype.on;
// If the user uses them, then switch into old mode.
Readable.prototype.resume = function() {
emitDataEvents(this);
this.read(0);
};
Readable.prototype.pause = function() {
@ -566,6 +567,8 @@ function emitDataEvents(stream, startPaused) {
process.nextTick(function() {
stream.emit('readable');
});
else
this.read(0);
};
// now make it start, just in case it hadn't already.

Loading…
Cancel
Save