Support mintty on MINGW64
Mintty is installed along with Git for Windows.
Is there any chance to support mintty?
I don't have issues with mintty on Windows.
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?
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.
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
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
looks like this is related to #432
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:

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