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

keypress blocking event-loop (node v0.12.0) #15

Open
xat opened this issue Feb 21, 2015 · 3 comments
Open

keypress blocking event-loop (node v0.12.0) #15

xat opened this issue Feb 21, 2015 · 3 comments

Comments

@xat
Copy link

xat commented Feb 21, 2015

On node v0.12.0 the event-loop seems to get blocked after hitting a key a few times.

See this simple code:

var keypress = require('keypress');
var c = 0;

setInterval(function() {
  console.log('tick', c++);
}, 1000);

keypress(process.stdin);

process.stdin.on('keypress', function (ch, key) {
  console.log('key pressed');
  if (key && key.ctrl && key.name == 'c') {
    process.exit();
  }
});

process.stdin.setRawMode(true);
process.stdin.resume();

There is a ticker supposed to output tick <counter> every second. On node v0.10.x the ticker outputs its message in the expected interval, no matter how often you press a key.
On node v0.12.0 something blocks the ticker from outputting after hitting, for example, the space-key a few times. The Number of keypresses which are required to make start it block seems to be random. Sometimes it blocks after the first keypress, some other times it takes up to 5 keypresses.

I'm running node on OSX Yosmite.

@xat
Copy link
Author

xat commented Feb 21, 2015

The exact node version when this problem starts to occur is v0.11.12

http://blog.nodejs.org/2014/03/12/node-v0-11-12-unstable/

@brycebaril
Copy link

Unable to reproduce in 0.12 or io.js on Ubuntu

@GabiGrin
Copy link

Happening to me too
Node v0.12.4, OS X 10.9.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants