[PATCH] Cygwin: console, pty: Prevent error in legacy console mode.

Takashi Yano takashi.yano@nifty.ne.jp
Wed Nov 6 15:44:00 GMT 2019

On Wed, 6 Nov 2019 08:06:55 -0700
Brian Inglis wrote:
> > +      if (con.is_legacy)
> > +	setenv ("TERM", "cygwin", 1);
> >      }
> handlers should not be changing user's env vars: that is the user's selection to
> get their preferred operation in their apps.
> If you need to set TERM, shouldn't you also set it appropriately for non-legacy
> console?

The environment TERM is set to cygwin or xterm-256color in environ.cc
based on wincap.has_con_24bit_colors().

However, if legacy console mode is enabled, new terminal capability
compatible with xterm is disabled. So TERM is override to cygwin by
the code above.

This is done only in the first initialization stage, so TERM value
set by user in .login, .bashrc, .tcshrc and etc, ... will be kept.

Only the case in which TERM is overrid is:
1) Enable console legacy mode.
2) Open command prompt.
3) set TERM
4) start cygwin

What situation do you assume this causes problem?

Takashi Yano <takashi.yano@nifty.ne.jp>

More information about the Cygwin-patches mailing list