This is the mail archive of the cygwin-developers mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

winpty injection

The interworking problems of pty-based terminals with native Windows programs have long been discussed and raise recurring user reports and complaints. Mintty issues (Improve support for native console programs) and (Use different encodings for native Windows commands output and remote output) have dozens of duplicates. There is the fairly well-known wrapper winpty which solves most of the interworking problems. However, it needs to be involved explicitly and selectively for Windows command-line applications.

So I had the idea that cygwin could apply winpty wrapping automatically when it detects that a non-cygwin command-line program is being called. The attached patch demonstrates how this would work. It is a proof-of-concept, not ready for integration but provided for discussion of the approach (thus not sent to cygwin-patches).
If it is appreciated, there are a number of open issues:
* The patch offers two methods. The activated one (#ifdef inject_winpty_recursively) works but leaves a memory leak in the argv1 array needed to expand the argv with the injected wrapper. The other one, which tries to inject winpty into argv and then continue the function linearly, would solve the memory leak but does not work (yet)... * The winpty tool is not even a cygwin package yet. If the injection approach is approved, it should be packaged as a base package, or even its code could be migrated into cygwin. * As some people may object such a magic (and it might in fact raise unexpected problems), it could also be made dependent on a setting in the CYGWIN environment variable.

Looking forward to feedback

Attachment: 0000-winpty-injection-proof-of-concept.patch
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]