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

Input issue with Node 11? #778

Closed
Ezekiel-DA opened this issue Jan 31, 2019 · 7 comments
Closed

Input issue with Node 11? #778

Ezekiel-DA opened this issue Jan 31, 2019 · 7 comments

Comments

@Ezekiel-DA
Copy link

Hi,

first, a big thank you for this awesome library! It's made my life considerably easier when building command line apps.

I did run into a very strange issue today though: after upgrading to the Node 11 line (I tested both 11.8.0 and 11.9.0), I am finding that selection input in a list is messed up.

Here's an absolutely minimal reproduction:

const inquirer = require('inquirer')

async function main () {
  let res = await inquirer.prompt([
    {name: 'test', type: 'list', message: 'question1?', choices: [{name: 'a', value: 1}, {name: 'b', value: 2}, {name: 'c', value: 3}], default: 1}
  ])
}

main()

Install inquirer and run this super basic script with Node as usual.

This obviously results in this prompt:

? question1? (Use arrow keys)
> a
  b
  c

I would expect the arrow keys to navigate this list in the obvious way; what ends up happening though is that inputs are repeated, i.e. one press of the down arrow moves to b and then immediately to c.

This occurs in any terminal (cmd.exe, Powershell, Git Bash/MinGW). As far as I can tell without a real Linux box on hand, this seems to be Windows specific (a quick run of the above script in the Docker images for Node 10 and Node 11 both worked correctly).

If I uninstall Node 11 and return to Node 10 LTS (10.15.1 currently), the problem disappears.

Any thoughts?

@SBoudrias
Copy link
Owner

Any chance you called inquirer 2 times? Maybe there's some issue with listeners cleanup on the readline?

@marcoschaarschmidt
Copy link

I've the same problem on a windows machine with node 11.9.0 too.

@Ezekiel-DA
Copy link
Author

Any chance you called inquirer 2 times? Maybe there's some issue with listeners cleanup on the readline?

I'm literally invoking the 5 line script so that's unlikely!

I've actually narrowed down the issue to Node 11.8.0. The exact same script behaves correctly with 11.7.0 and fails with 11.8.0.

Currently git bisecting the Node repo and rebuilding to try and narrow it down, which isn't exactly how I was intending to spend my work day but I can't have this internal tool I built start misbehaving just as we were starting to deploy it to everyone 😱

I suppose this means this issue isn't really for you but once I know the exact commit in Node that breaks this I might need your expert opinion on what they broke!

@nicojs
Copy link

nicojs commented Feb 13, 2019

I can confirm that it still persists in node 11.9 :(

@Ezekiel-DA
Copy link
Author

The underlying issue in libuv has been fixed and the relevant upgrade of the dependencies was just merged in Node: nodejs/node#26037

So the fix for this should be an upcoming in Node 11.9.1 soon, I guess!

@SBoudrias
Copy link
Owner

Thanks a ton for following up on this @Ezekiel-DA !!

@Ezekiel-DA
Copy link
Author

This is fixed with Node 11.10.0!

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

4 participants