GeezerVison is showing github.com — Looks like readline don't always triggers keypress events on Windows · Issue #2996 · nodejs/node
Looks like readline don't always triggers keypress events on Windows #2996Labels confirmed-bugIssues and PRs for confirmed bugs.streamIssues and PRs related to Node.js streams.windowsIssues and PRs related to the Windows platform. DescriptionHi there, I'm the author on Inquirer.
I would've love to have more details to report on this bug. But I don't have much currently, I'm hoping someone would be able to help in getting more precise information. Also, due to this blindness, I can't exclude totally that this is an issue with Inquirer; all I know is these bug reports started to appear on my repo recently.
Basically, it looks like on Windows (since mostly Node 4.0), readlines don't always triggers keypress events the first time we initialize one. This have reported on Inquirer repository: SBoudrias/Inquirer.js#266
Some people the issue have said they've been able to reproduce using only a readline directly, but it's not super clear what they've done.
On my side, I've been unable to reproduce this bug on any Windows VM. So I really have a hard time to come up with reproducible step for you. Activitymaxdow commented on Sep 22, 2015 Here an example to reproduce the problem :
var readline = require("readline");
var rl = readline.createInterface(process.stdin, process.stdout);
rl.on("line",function(){
console.log("line event");
});
process.stdin.on("keypress",function(){
console.log("keypress");
});
On a win8 computer, i don't have the keypress event triggered at first. I have to press enter to "trig" the keypress event. On win xp there is no problem, i got keypress and line events separatly.
I suppose it works the same as win xp on linux .
Inquirer.js list run fine on win xp that's why it's probably related to node peterblazejewicz commented on Sep 22, 2015 same: Win: 8.1 Node: 4.1.0 sayedihashimi commented on Sep 22, 2015 cveld commented on Sep 25, 2015 On Windows 10 Node 4.1.0 I don't have the issue in a node session kicked off from cmd.exe. Although the Node interactive window within Visual Studio 2015 does not show any event handler activity. But my guess is that this is due the design of the Node interactive window. tienloc1 commented on Sep 27, 2015 On Windows 8.1 (node-v0.12.6), the keypress events work for me in cmd.exe but it still not work in git bash. (git-v2.5.3). dthree commented on Sep 29, 2015 darrellenns commented on Sep 29, 2015 I'm also having this issue since upgrading to windows 10. Using maxdow's sample code, I get no keypress events until I press enter. Once I press enter, all the previous keypress events trigger at once. After that, keypress events trigger as normal.
I have tried this in both powershell and cmd, and I've also tried changing them to "legacy console" (in cmd/powershell preferences). All had the same behavior. darrellenns commented on Sep 29, 2015 Also just tried opening node.js in a new window using the command "start node test.js". Still exhibits the same issue. silverwind commented on Sep 29, 2015 peterblazejewicz commented on Sep 30, 2015 @silverwind
You could be on the right track. My setup: Win 8.1, Node 4.1.1. I've symlinked to 2.0.1:
and the problem goes away.
We are tracking this problem on project that uses readline under the hood:
OmniSharp/generator-aspnet#351
Thanks! edi9999 commented on Oct 6, 2015 silverwind commented on Oct 6, 2015 peterblazejewicz commented on Oct 6, 2015 nzakas commented on Dec 21, 2015 Any chance this fix will make it into LTS? ESLint is continuing to get reports of this problem from LTS users as of 4.2.3. MylesBorins commented on Dec 21, 2015 @nzakas it is in staging and planned to land in 4.2.4 :D nzakas commented on Dec 21, 2015 peterblazejewicz commented on Jan 4, 2016 4.2.4 (LTS) on Windows 10 works terrific in all terminals I'm using:
Thanks! ThaJay commented on Feb 18, 2016 looks like this issue is back:
I just had this bug in Windows 10 with Git Bash or PowerShell, Node 5.6.0 and eslint 2.1.0.
As all topics I have found say this is fixed, I installed the latest Git for Windows (version 2.7.1).
The arrow keys still did not work.
eslint/eslint#3395 (comment) hgcummings commented on Feb 18, 2016 As noted in the eslint issue thread linked above, I've seen this working with Node 5.4.1 and failing in 5.6.0, on the same Windows 10 box. Consistent across multiple terminals (cmd, PowerShell, bash). silverwind commented on Feb 29, 2016 See #5384 for the current issue. sschmidTU commented on Jul 9, 2018 Keypresses are actually executed invisibly in Git Bash. At least for me.
It's a Git bash/Non-TTY terminal issue, FoRVaiS pretty much researched all there is to know about it here:
terkelg/prompts#36
MetadataMetadataconfirmed-bugIssues and PRs for confirmed bugs.streamIssues and PRs related to Node.js streams.windowsIssues and PRs related to the Windows platform. DevelopmentNo branches or pull requestsIssue actions
|