Cygwin: console: Change timing of set/unset xterm compatible mode.
- If two cygwin programs are executed simultaneousley with pipes in cmd.exe, xterm compatible mode is accidentally disabled by the process which ends first. After that, escape sequences are not handled correctly in the other app. This is the problem 2 reported in https://cygwin.com/ml/cygwin/2020-02/msg00116.html. This patch fixes the issue. This patch also fixes the problem 3. For these issues, the timing of setting and unsetting xterm compatible mode is changed. For read, xterm compatible mode is enabled only within read() or select() functions. For write, it is enabled every time write() is called, and restored on close().
This commit is contained in:
committed by
Corinna Vinschen
parent
bb25dd1b0f
commit
774b8996d1
@ -615,22 +615,13 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
|
||||
{
|
||||
attach_to_console = true;
|
||||
if (wincap.has_con_24bit_colors () && !iscygwin ())
|
||||
{
|
||||
DWORD dwMode;
|
||||
if (fd == 0)
|
||||
{
|
||||
/* Disable xterm compatible mode in input */
|
||||
GetConsoleMode (fh->get_handle (), &dwMode);
|
||||
dwMode &= ~ENABLE_VIRTUAL_TERMINAL_INPUT;
|
||||
SetConsoleMode (fh->get_handle (), dwMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetConsoleMode (fh->get_output_handle (), &dwMode);
|
||||
dwMode &= ~ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||
SetConsoleMode (fh->get_output_handle (), dwMode);
|
||||
}
|
||||
}
|
||||
if (fd == 1 || fd == 2)
|
||||
{
|
||||
DWORD dwMode;
|
||||
GetConsoleMode (fh->get_output_handle (), &dwMode);
|
||||
dwMode &= ~ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||
SetConsoleMode (fh->get_output_handle (), dwMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user