diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 14165bdfc..df01cb0cf 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -1246,7 +1246,7 @@ fhandler_pty_slave::ioctl (unsigned int cmd, void *arg) DWORD pidRestore = 0; if (!pcon_attached) { - if (has_master_opened ()) + if (has_master_opened () && get_ttyp ()->attach_pcon_in_fork) goto resize_cyg; pidRestore = fhandler_console::get_console_process_id @@ -1536,8 +1536,11 @@ fhandler_pty_master::fhandler_pty_master (int unit) fhandler_pty_master::~fhandler_pty_master () { + /* Without this wait, helper process for pseudo console + sometimes remains running after the pty session is + closed. The reason is not clear. */ if (to_master && from_master) - close (); + Sleep (20); } int