Cygwin: console: Add guard for set/unset xterm compatible mode.

- Setting / unsetting xterm compatible mode may cause race issue
  between multiple processes. This patch adds guard for that.
This commit is contained in:
Takashi Yano
2020-02-18 18:12:54 +09:00
committed by Corinna Vinschen
parent 321d79abd3
commit 81b3440998
4 changed files with 103 additions and 58 deletions

View File

@@ -614,14 +614,10 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
else if (fh && fh->get_major () == DEV_CONS_MAJOR)
{
attach_to_console = true;
fhandler_console *cons = (fhandler_console *) fh;
if (wincap.has_con_24bit_colors () && !iscygwin ())
if (fd == 1 || fd == 2)
{
DWORD dwMode;
GetConsoleMode (fh->get_output_handle (), &dwMode);
dwMode &= ~ENABLE_VIRTUAL_TERMINAL_PROCESSING;
SetConsoleMode (fh->get_output_handle (), dwMode);
}
cons->request_xterm_mode_output (false);
}
}