Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream,win: fix ghost keypress events #5776

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,8 @@ Readable.prototype.pause = function() {
if (false !== this._readableState.flowing) {
debug('pause');
this._readableState.flowing = false;
this.emit('pause');
// Emit 'pause' on next tick as we do for 'resume'
process.nextTick(() => this.emit('pause'));
}
return this;
};
Expand Down
8 changes: 7 additions & 1 deletion lib/tty.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,23 @@ function ReadStream(fd, options) {
if (!(this instanceof ReadStream))
return new ReadStream(fd, options);

// pauseOnCreate to avoid reading from the sytem buffer
options = util._extend({
highWaterMark: 0,
readable: true,
writable: false,
handle: new TTY(fd, true)
handle: new TTY(fd, true),
pauseOnCreate: true
}, options);

net.Socket.call(this, options);

this.isRaw = false;
this.isTTY = true;

// Let the stream resume automatically when 'data' event handlers
// are added, even though it was paused on creation
this._readableState.flowing = null;
}
inherits(ReadStream, net.Socket);

Expand Down