diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc index 9cdc13dd2..ac47c8374 100644 --- a/winsup/cygwin/fhandler/console.cc +++ b/winsup/cygwin/fhandler/console.cc @@ -84,6 +84,10 @@ fhandler_console::attach_console (pid_t owner, bool *err) DWORD attached = fhandler_pty_common::get_console_process_id (p->dwProcessId, true, false, false); + if (!attached) + attached = + fhandler_pty_common::get_console_process_id (p->exec_dwProcessId, + true, false, false); if (!attached) { resume_pid = @@ -91,6 +95,8 @@ fhandler_console::attach_console (pid_t owner, bool *err) false, false, false); FreeConsole (); BOOL r = AttachConsole (p->dwProcessId); + if (!r) + r = AttachConsole (p->exec_dwProcessId); if (!r) { if (resume_pid)