msys2/MINGW-packages

default msys2 console is unusable in win10

pps83 opened this issue · 9 comments

pps83 commented

something is wrong with default msys2 console window on win10 (not sure if that's win10 specific). If I open msys2 console (which uses mintty by default) then i cannot use any interpreters the way it used work. For example, if I simply run node then I can type wherever I want there and nothing will happen, as if nothing was entered, no js gets executed. Same problem with perl. In my case node is regular win32 isntall of node, perl is msys perl. If I use non mintty terminal, then everything works as expected.

On top of that, after updating to latest msys I had to uncomment set MSYS2_PATH_TYPE=inherit to ensure that node can be found. By default msys2_shell start mintty: if NOT EXIST "%WD%mintty.exe" goto startsh, but if you change it to always startsh then it won't use mintty and default bash will be used, which to me looks now identical to mintty, not even shure what the difference now, except that node and perl in interactive mode work properly

jtanx commented

Try installing winpty (pacman -S winpty) and running the command like winpty node

There is a fix in git for detecting if the standard handles are connected to a named pipe and the name is checked to see if it is a Cygwin pipe. It might be worth turning this into a new msys2_isatty() function and using that in all the packages that have this problem. We would need to ask for very liberal licensing permission for that though so that we can use it everywhere, or else we'd need to write our own version without reference to the original.

pps83 commented

regarding winpty node - I think it's quite strange that normal commands will need to be run that way. Default console in msys2 should behave properly, just like everyone expects.

It depends what your definition of "normal commands" is. Programs that run under the msys-2.0.dll/Cygwin POSIX emulation environment will work fine in MinTTY. Native Windows programs like node, or anything in /mingw64/bin or /mingw32/bin are from a different runtime environment so they are not perfectly compatible with msys-2.0.dll/Cygwin.

You can run MSYS2 in a native Windows console instead of MinTTY, which should allow interactive native Windows programs to work better. I know that MinGW interactive Ruby (irb) works better. I use this simple batch script to launch MSYS2 and one of the features is that I can select which terminal to use:

https://gist.github.com/DavidEGrayson/2e5923b9c0d8acb3f7a7

pps83 commented

@DavidEGrayson did it always have that problem with "normal commands", or it's something that was introduced recently? Maybe I haven't noticed that before if the problem always existed.

I think it has not changed recently. The isatty function called by MinGW programs comes from Microsoft's msvcrt.dll so it doesn't know about or support msys-2.0/Cygwin and I doubt there were any recent changes to it.

pps83 commented

Well, anyways, I've made some changes in my msys2_shell.cmd and I have no problems and everything works perfectly. First of all, I did this (with new msys2 update lots of functionality stopped working for me because of this change):

rem To export full current PATH from environment into MSYS2 use '-use-full-path' parameter
rem or uncomment next line
set MSYS2_PATH_TYPE=inherit

and second thing, i changed if NOT EXIST "%WD%mintty.exe" goto startsh to goto startsh and everything works perfectly for me, regular node etc, and console behaves well, just like regular putty.

nodejs is no longer available.