winpty
winpty copied to clipboard
Use Microsoft’s new ConPTY API on Windows versions which support it (i.e. Fall 2018 and newer)
https://blogs.msdn.microsoft.com/commandline/2018/08/02/windows-command-line-introducing-the-windows-pseudo-console-conpty/
As winpty is one of the most commonly used PTY implementations in Windows programs which need PTY functionality, to reduce work for third parties which rely on winpty, it would be a good idea if the winpty library would simply become a translation layer on Windows 10 Fall 2018 update and newer by using the ConPTY detection mechanism outlined in the linked article.
Related: Microsoft/node-pty#216
There should probably be a layer somewhere that chooses between ConPTY and winpty's current agent-based scraping. It could make sense to just put that layer in winpty itself. I'll try to work on this sometime.
There should probably be a layer somewhere that chooses between ConPTY and winpty's current agent-based scraping.
Yes this is the strategy I'm using for node in https://github.com/Microsoft/node-pty/issues/216, I'll detect the feature set and either run conpty or fallback to winpty.
@rprichard Lemme know if you need any help adding support for conpty, or if you find any bugs or gaps in functionality. I'm happy to help in any way I can :)
Hi,
My two cents about this:
- Some programs (or several) use the CygTerm mode to interact with the Cygwin console Apps. The basis it's the
cthelper.exe
process. - As the new Win10 ConAPI support PTY for any Windows/WSL console Apps, now it's possible to execute all Cygwin/SSH/Win32/WSL console Apps inside the WSL Bash shell.
- Then, you can prepare a "simple" modification of the
cthelper.exe
that runs win the WSL BASH SHELL, instead of the CygWin BASH (or with any other native Win10 shell). - And with this change any program that has support for the CygTerm CTHELPER will obtain console support.
So, in summary: Why not create a new cthelper-wsl.exe
?
What you think?
I'd like to add, that testing if api functions present isn't sufficient, new console could be disabled in settings ("Use legacy console") by windows admin user. For compatibility I guess.
Need to check about this option.
@rprichard Do you plan to implement it in winpty?
@rprichard are you still maintaining this or is there an alternative?
What's the reason for using winpty if ConPTY is available, though? From what I can see, it provides a similar interface by itself.
@ForNeVeR support for Windows before Windows 10
Just curious - do you know of or assume large amount of pre-Windows 10 installations? Win 11 is knocking on the door, so I'm not sure this will be that important soon.
Cygwin itself now supports ConPTY (it is disabled in MSYS2 by default, though). Supporting it in winpty might not be so important.