Description
The functions in System.Win32.MinTTY
are no longer able to detect newer versions of mintty
. I'm not sure which version of mintty
changed its behavior, but I can confirm this happening for mintty
3.6.1.
Current Behavior
isMinTTY
will return False
on mintty
3.6.1.
Currently, isMinTTY
expects that STD_ERROR_HANDLE
will always have FILE_TYPE_PIPE
and uses GetFileInformationByHandleEx
to query information about the pipe. On recent versions of mintty
, however, STD_ERROR_HANDLE
will instead have FILE_TYPE_CHAR
. If I try to to use GetFileInformationByHandleEx
on this version of STD_ERROR_HANDLE
, it will fail with getFileInformationByHandleEx: invalid argument (Incorrect function.)
.
On the other hand, perhaps this isn't as bad as it sounds. One of the reasons why I wanted the ability to detect the presence of mintty
in the first place is that in the past, mintty
hasn't supported GHCi very well. Namely, you couldn't use tab completion, you couldn't use arrow keys to navigate through your command history, and Ctrl-C would completely bork GHCi. With recent versions of mintty
, however, that all appears to be working as expected! That is to say: mintty
and GHCi appear to get along just fine nowadays.
In light of this, perhaps we should just change the documentation for System.Win32.MinTTY
to say that it only detects old versions of mintty
? I'd consider that a satisfactory resolution, but perhaps there are other reasons one might want to detect mintty
. If that is the case, we'd need a different way to detect it than what System.Win32.MinTTY
is currently using.
Steps to Reproduce (for bugs)
To reproduce the bug, simply run isMinTTY
using mintty 3.6.1
, which is currently the latest version offered by MSYS2 at the time of writing.
$ mintty.exe --version
mintty 3.6.1 (x86_64-pc-msys)
© 2022 Thomas Wolff, Andy Koppe
License GPLv3+: GNU GPL version 3 or later
There is no warranty, to the extent permitted by law.
$ ghci
> import System.Win32.MinTTY
> isMinTTY
False
Your Environment
- GHC 9.2.4
- Windows 10.0.19045 Build 19045