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]

Re: winpty injection


Am 05.04.2018 um 21:41 schrieb Johannes Schindelin:
Hi Thomas,

On Thu, 5 Apr 2018, Thomas Wolff wrote:

Am 05.04.2018 um 15:25 schrieb Johannes Schindelin:
On Thu, 5 Apr 2018, Corinna Vinschen wrote:

On Apr  4 19:07, Thomas Wolff wrote:

* 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.
Nah.  If it improves the situation, nobody will complain.  However, it
may slow down calling native Windows apps considerably when used a lot
from scripts.
We suggest `winpty` quite a bit in Git for Windows' bug tracker. And it is
not without problems... for example, when calling Maven in MinTTY via
`winpty mvn`, the `TERM` variable is still set as appropriate for MinTTY,
and consequently, the color codes of Maven's output show up as ugly
special characters...
This sounds weird, as ANSI colour controls do not differ among
terminals. What if you set TERM=cygwin or unset TERM before `winpty
mvn`?  What's even weirder is that I cannot even reproduce the test
case, as `winpty mvn` tells me "Could not start 'mvn.exe': The system
could not find the file.  (error 0x2)", although `mvn` works.
In Git for Windows, we set `TERM=xterm`, not `TERM=cygwin` before
launching MinTTY. That might explain the difference?

Also, the reporter claimed the same about `winpty mvn`, as winpty does not
use the shell to execute shell scripts on the `PATH`, and the solution was
to run `winpty sh $(which mvn)`.
OK, winpty cannot start mvn because that's a shell script, not an exe. winpty can start mvn.cmd directly, and in this case (after back-converting JAVA_HOME to Windows syntax) I can reproduce the issue. However, I do not see where the text output comes from; it's not from the mvn wrapper and anything else is Java libraries. So the question is, what does the Java runtime do with an escape character output by the Java code? Especially as winpty seems to unset TERM (test case: winpty cmd, then echo %TERM%). winpty itself lets escape characters pass through, at least (test case: winpty echoesc.cmd, which contains echo "...." with a colouring escape sequence with verbatim escape characters). These symptoms suggest to me: winpty is not the culprit, but its presence in the invocation chain seems to trigger the effect in a yet unclear way.
Thomas

See
https://github.com/git-for-windows/git/issues/1470#issuecomment-365618938
for details.

Ciao,
Johannes


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