4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-19 04:49:25 +08:00

Cygwin: pty: Fix potential state mismatch regarding pseudo console.

- PTY with pseudo console support sitll has problem which potentially
  cause state mismatch between state variable and real console state.
  This patch fixes this issue.
This commit is contained in:
Takashi Yano 2019-09-05 19:44:41 +09:00 committed by Corinna Vinschen
parent 915fcd0ae8
commit b7e4294200

View File

@ -159,14 +159,19 @@ dtable::stdio_init ()
{
bool attached = !!fhandler_console::get_console_process_id
(ptys->getHelperProcessId (), true);
if (!attached)
if (attached)
break;
else
{
/* Not attached to pseudo console in fork() or spawn()
by some reason. This happens if the executable is
a windows GUI binary, such as mintty. */
FreeConsole ();
if (AttachConsole (ptys->getHelperProcessId ()))
break;
{
ptys->fixup_after_attach (false);
break;
}
}
}
}