Am 21.11.2025 um 11:04 schrieb Takashi Yano via Cygwin:
Hi Thomas,
I'm very sorry for replying so late.
On Sun, 5 Oct 2025 10:15:55 +0200
Thomas Wolff wrote:
Am 10.09.2025 um 11:21 schrieb Thomas Wolff via Cygwin:
[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
It would also help if someone writes a small wrapper that loads a local
conpty.dll version, runs CreatePseudoConsole from it, and invokes
wsl.exe (likely with CreateProcess). I somehow fail to get this working,
being umfamiliar with Windows intrinsics...
I'm not sure what is the advantage of dynamic conpty loading.
Does this allow use newer functionality than using conhost.exe?
Yes, it allows to use the conpty.dll version retrieved from the Windows
Terminal project which fixes a lot of interaction problems for pty-based
programs.
In Windows 10, for example, the current conhost version does not allow
terminal mouse modes so mouse in editor, mc etc would not work.
--
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