GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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 #2996

New issue
Copy link
New issue
Copy link
Closed
Closed
Looks like readline don't always triggers keypress events on Windows#2996
Copy link
Labels
confirmed-bugIssues and PRs for confirmed bugs.streamIssues and PRs related to Node.js streams.windowsIssues and PRs related to the Windows platform.

Description

@SBoudrias
SBoudrias
opened on Sep 22, 2015
Issue body actions

Hi 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.

Activity

Next
  1. maxdow commented on Sep 22, 2015

    @maxdow
    maxdow
    on Sep 22, 2015
    More actions

    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

  2. peterblazejewicz commented on Sep 22, 2015

    @peterblazejewicz
    peterblazejewicz
    on Sep 22, 2015
    More actions

    same: Win: 8.1 Node: 4.1.0

  3. brendanashworth
    added
    readlineIssues and PRs related to the built-in readline module.
    windowsIssues and PRs related to the Windows platform.
    on Sep 22, 2015
  4. sayedihashimi commented on Sep 22, 2015

    @sayedihashimi
    sayedihashimi
    on Sep 22, 2015
    More actions

    +1 ran into this as well

  5. cveld commented on Sep 25, 2015

    @cveld
    cveld
    on Sep 25, 2015
    More actions

    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.

  6. tienloc1 commented on Sep 27, 2015

    @tienloc1
    tienloc1
    on Sep 27, 2015
    More actions

    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).

  7. dthree commented on Sep 29, 2015

    @dthree
    dthree
    on Sep 29, 2015
    More actions

    Also ran into this.

  8. darrellenns commented on Sep 29, 2015

    @darrellenns
    darrellenns
    on Sep 29, 2015
    More actions

    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.

  9. darrellenns commented on Sep 29, 2015

    @darrellenns
    darrellenns
    on Sep 29, 2015
    More actions

    Also just tried opening node.js in a new window using the command "start node test.js". Still exhibits the same issue.

  10. silverwind commented on Sep 29, 2015

    @silverwind
    silverwind
    on Sep 29, 2015
    Contributor
    More actions

    I suspect it could be related to aed6bce. Could one of you try if the issue persists with the last build before this commit, 2.0.1: https://iojs.org/download/release/v2.0.1/win-x64/ ?

  11. peterblazejewicz commented on Sep 30, 2015

    @peterblazejewicz
    peterblazejewicz
    on Sep 30, 2015
    More actions

    @silverwind
    You could be on the right track. My setup: Win 8.1, Node 4.1.1. I've symlinked to 2.0.1:

    node --version
    v2.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!

  12. edi9999 commented on Oct 6, 2015

    @edi9999
    edi9999
    on Oct 6, 2015
    More actions

    Same problem here, as reported here : workshopper/workshopper-adventure#11

  13. silverwind commented on Oct 6, 2015

    @silverwind
    silverwind
    on Oct 6, 2015
    Contributor
    More actions

    cc: @rlidwka

    @peterblazejewicz could you by change confirm that https://iojs.org/dist/v2.0.2/win-x64/ breaks it?

  14. peterblazejewicz commented on Oct 6, 2015

    @peterblazejewicz
    peterblazejewicz
    on Oct 6, 2015
    More actions

    @silverwind

    @peterblazejewicz could you by change confirm that https://iojs.org/dist/v2.0.2/win-x64/ breaks it?

    Well, I've used and tested v.2.0.1 - which appears to fix problem. I'll test v2.0.2 tomorrow (CEST) and post back.

  15. 31 remaining items

  16. silverwind
    added a commit that references this issue on Nov 16, 2015

    src: Revert "nix stdin _readableState.reading"

    550c606
  17. silverwind
    added a commit that references this issue on Dec 4, 2015

    src: Revert "nix stdin _readableState.reading"

    08e23eb
  18. silverwind
    added a commit that references this issue on Dec 17, 2015

    src: Revert "nix stdin _readableState.reading"

    9b05905
  19. nzakas commented on Dec 21, 2015

    @nzakas
    nzakas
    on Dec 21, 2015
    More actions

    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.

  20. MylesBorins commented on Dec 21, 2015

    @MylesBorins
    MylesBorins
    on Dec 21, 2015
    Contributor
    More actions

    @nzakas it is in staging and planned to land in 4.2.4 :D

  21. nzakas commented on Dec 21, 2015

    @nzakas
    nzakas
    on Dec 21, 2015
    More actions

    Awesome, thanks @thealphanerd

  22. silverwind
    added a commit that references this issue on Dec 23, 2015

    src: Revert "nix stdin _readableState.reading"

    946fe61
  23. peterblazejewicz commented on Jan 4, 2016

    @peterblazejewicz
    peterblazejewicz
    on Jan 4, 2016
    More actions

    4.2.4 (LTS) on Windows 10 works terrific in all terminals I'm using:

    • CMD
    • PowerShell
    • Git Bash

    Thanks!

  24. ThaJay commented on Feb 18, 2016

    @ThaJay
    ThaJay
    on Feb 18, 2016
    More actions

    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)

  25. hgcummings commented on Feb 18, 2016

    @hgcummings
    hgcummings
    on Feb 18, 2016
    More actions

    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).

    Reacted by Neil Crow
  26. silverwind commented on Feb 29, 2016

    @silverwind
    silverwind
    on Feb 29, 2016
    Contributor
    More actions

    See #5384 for the current issue.

  27. sschmidTU commented on Jul 9, 2018

    @sschmidTU
    sschmidTU
    on Jul 9, 2018
    More actions

    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

  28. sjarmak
    added a commit that references this issue on Jul 27, 2026

    src: Revert "nix stdin _readableState.reading"

    af46112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.streamIssues and PRs related to Node.js streams.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.