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

up/down keys on Windows have broken behavior in windows #5821

Closed
martinheidegger opened this issue Mar 21, 2016 · 7 comments
Closed

up/down keys on Windows have broken behavior in windows #5821

martinheidegger opened this issue Mar 21, 2016 · 7 comments
Labels
tty Issues and PRs related to the tty subsystem. windows Issues and PRs related to the Windows platform.

Comments

@martinheidegger
Copy link

At nodeschool we have had reports for a while that the workshoppers don't work on windows. Issues for reference: workshopper#420 nodeschool/discussions#1641.

After some research I found out that from Node 5.6 on it seems like some system code is overriding the cursor up/down behavior in the rawmode of tty.

Since it is a bit hard to explain I prepared a short video showing the behavior. Youtube Link

It uses the following script:

var stdin = process.stdin;

stdin.on('data', function (data) {
  data = data.toString()
  console.log(data.split("").map(function (chr) { return chr.charCodeAt(0) }))
  process.exit();
})
stdin.resume()
stdin.setRawMode(true)

Gist

  • Version: Node 5.6 +
  • Platform: Definitely tested on Windows 10
  • Subsystem: process.stdin
@Fishrock123 Fishrock123 added tty Issues and PRs related to the tty subsystem. windows Issues and PRs related to the Windows platform. labels Mar 21, 2016
@Fishrock123
Copy link
Contributor

Hmmm I didn't see anything obvious from v5.6.0's commit log. I don't think this is the same issue as #5776 either.

cc @nodejs/platform-windows

@egoroof

This comment was marked as abuse.

@Fishrock123
Copy link
Contributor

Hmm, maybe it is this same bug. The c-ares upgrade was in 5.6.0.

@martinheidegger
Copy link
Author

Seems like it is the same bug (why didn't it show up in my search for issues)

@orangemocha
Copy link
Contributor

I think this is likely to be the same as #5384. Investigating that issue I found that accessing process.stdin causes asynchronous reads to be started and then canceled. So there is a race condition between those reads being canceled and the console being set in raw mode. If the reads don't get canceled in time, they will consume keypress events from the system buffers before the console is set in raw mode.

tl;dr: could you please test the change at #5776 and see if it solves this issue?

@martinheidegger
Copy link
Author

@orangemocha Seems like that issue was reverted. But it does sound like we are talking about the same issue.

@jasnell
Copy link
Member

jasnell commented Apr 22, 2016

Closing as a duplicate of #5384. The issue still exists we just don't need multiple issues open for it! It's being investigated still! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tty Issues and PRs related to the tty subsystem. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

5 participants