[Reposting by response from cygwin-developers]

I wrote:
The ancient conhost and also the initial conpty implementation of Windows were obstacles to using terminal feature from Windows applications. There are nuisances like mangled or ignored character attributes, terminal reports not passed through etc. While there is an updated Windows conpty layer being developed as part of the Windows terminal project, it is not yet deployed with Windows 11 and will probably not be deployed with Windows 10 at all anymore (https://github.com/microsoft/terminal/issues/17452). Various terminals had to fight with these problems and some found a solution. According to https://github.com/saitoha/libsixel/issues/199#issuecomment-3181728693 it is possible to inject a specific version of conpty so to supersede the Windows-installed conhost.exe.

I've tried to apply that to mintty by just preloading a conpty.dll before calling forkpty for the terminal child process but that has no effect.
The procedure seems to be:
try LoadLibrary("conpty.dll"), (if not successful, fallback to GetModuleHandle("kernel32") instead) to retrieve GetProcAddress for CreatePseudoConsole, ResizePseudoConsole, ClosePseudoConsole, and then somehow (?) use those while calling CreateProcess. The latter is woven into the cygwin library and I don't think it's a good idea to clone that out of cygwin for a patched process creation in mintty.

My question/suggestion:
Can a cygwin mode switch to a selected conpty library instead of the default one please? My idea would be to configure this per process with the environment variable CYGWIN. Like its error_start= setting, it could have a conpty= setting to configure the filename to be used for conpty when starting a subprocess. That would allow mintty to inject a modern conpty when calling a Windows application (e.g. wsl.exe).

Thomas

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to