Cygwin: pty: add pseudo console support.

- Support pseudo console in PTY. Pseudo console is a new feature
  in Windows 10 1809, which provides console APIs on virtual
  terminal. With this patch, native console applications can work
  in PTYs such as mintty, ssh, gnu screen or tmux.
This commit is contained in:
Takashi Yano
2019-08-28 03:04:02 +09:00
committed by Corinna Vinschen
parent 398476acd2
commit 169d65a577
12 changed files with 2016 additions and 55 deletions

View File

@ -134,6 +134,30 @@ child_info::prefork (bool detached)
int __stdcall
frok::child (volatile char * volatile here)
{
cygheap_fdenum cfd (false);
while (cfd.next () >= 0)
if (cfd->get_major () == DEV_PTYM_MAJOR)
{
fhandler_base *fh = cfd;
fhandler_pty_master *ptym = (fhandler_pty_master *) fh;
if (ptym->getPseudoConsole () &&
!fhandler_console::get_console_process_id (
ptym->getHelperProcessId (), true))
{
debug_printf ("found a PTY master %d: helper_PID=%d",
ptym->get_minor (), ptym->getHelperProcessId ());
if (ptym->attach_pcon_in_fork ())
{
FreeConsole ();
if (!AttachConsole (ptym->getHelperProcessId ()))
/* Error */;
else
break;
}
}
}
HANDLE& hParent = ch.parent;
sync_with_parent ("after longjmp", true);