Inquirer.js icon indicating copy to clipboard operation
Inquirer.js copied to clipboard

Support mintty on MINGW64

Open TicoDePano opened this issue 8 years ago • 9 comments

Mintty is installed along with Git for Windows.

Is there any chance to support mintty?

TicoDePano avatar Dec 13 '17 22:12 TicoDePano

I don't have issues with mintty on Windows.

kbrandwijk avatar Jan 10 '18 05:01 kbrandwijk

I can confirm that in mintty (that comes with git for windows, no additional configuration) moving the cursor with arrows in prompts doesn't work at all. mintty tries to emulate xterm terminal, so I'd guess there would be some problems with xterm as well?

sunrize531 avatar Feb 25 '19 10:02 sunrize531

So, more info on this. When script with inquirer prompt in it called directly - it works perfectly fine in mintty too. But if the same script called via npm run in mintty running gitbash - it's completely screwed. Arrows don't work, you can't even close it with Ctrl-C and also the output lacks colours. Probably something to do with stdout/stdin pipes in mintty.

sunrize531 avatar Feb 26 '19 10:02 sunrize531

I can second what @sunrize531 mentioned above.

If Inquirer is using prompts, this thread may be of value.

https://github.com/terkelg/prompts/pull/36

bitmvr avatar Mar 20 '19 15:03 bitmvr

using this on Git Bash for Windows also duplicates the questions, making the library look extremely buggy

e.g.

? Would you like to create a config file? (Y/n)    # press enter to use the default
? Would you like to create a config file? Yes

Zamiell avatar Oct 19 '20 00:10 Zamiell

looks like this is related to #432

Zamiell avatar Oct 19 '20 00:10 Zamiell

I noticed that Inquirer was NOT duplicating text in a simple test repository, but was duplicating text in my real app, so I did some investigating.

The issue seems to be because:

  • when you type npx foo
  • it invokes a shell script located at C:\Users\[Username]\AppData\Roaming\npm\foo.cmd
  • which contains a line that invokes node like this:
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%"  "%dp0%\node_modules\test\dist\main.js" %*`

Essentially, this command ends up up being: "node" "path/to/foo.js"

When I take off the quotation marks around the "node" command, the bug seems to go away, as demonstrated by the following screenshot:

image

Pardon my French, but why the fuck is this happening? Why does putting quotation marks around node change the behavior of the resulting program? And is there some kind of fix that I can include in my JavaScript code to work around this problem?

Zamiell avatar Dec 08 '21 16:12 Zamiell

Why does putting quotation marks around node change the behavior of the resulting program?

Running node without quotes will respect the alias if there is one (check by running alias node).. Running "node" with quotes ignores the alias.

lbglb avatar Apr 20 '23 13:04 lbglb

Anyone narrowed down exactly what happens and how to fix/run the script with proper streams and/or interactive tty?

I'd be happy to document this in the README to help anyone running into this issue in the future.

SBoudrias avatar Apr 04 '24 21:04 SBoudrias