From 850b5a9aae49a9a0fa21d3ace385e8d6b03ae285 Mon Sep 17 00:00:00 2001 From: Takashi Yano via Cygwin-patches Date: Mon, 8 Mar 2021 22:14:58 +0900 Subject: [PATCH] Cygwin: pty: Attach to stub process when non-cygwin app inherits pcon. - If two non-cygwin apps are started simultaneously, attaching to pseudo console sometimes fails. This is because the second app trys to attach to the process not started yet. This patch avoids the issue by attaching to the stub process rather than the other non-cygwin app. --- winsup/cygwin/fhandler_tty.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 4358bceec..3bfc8c0c8 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -3104,7 +3104,7 @@ fhandler_pty_slave::setup_pseudoconsole (bool nopcon) 0, TRUE, DUPLICATE_SAME_ACCESS); CloseHandle (pcon_owner); FreeConsole (); - AttachConsole (p->dwProcessId); + AttachConsole (p->exec_dwProcessId); goto skip_create; }