Cygwin: pty: Transfer input for native app only if the stdin is pcon.

- Currently, transfer input is triggered even if the stdin of native
  app is not a pseudo console. With this patch it is triggered only
  if the stdin is a pseudo console.
This commit is contained in:
Takashi Yano via Cygwin-patches 2021-03-08 23:55:10 +09:00 committed by Corinna Vinschen
parent a9ff2cad68
commit 12325677f7
1 changed files with 10 additions and 8 deletions

View File

@ -3084,7 +3084,8 @@ fhandler_pty_slave::setup_pseudoconsole (bool nopcon)
if (get_ttyp ()->pcon_pid && get_ttyp ()->pcon_pid != myself->pid if (get_ttyp ()->pcon_pid && get_ttyp ()->pcon_pid != myself->pid
&& !!pinfo (get_ttyp ()->pcon_pid) && get_ttyp ()->pcon_activated) && !!pinfo (get_ttyp ()->pcon_pid) && get_ttyp ()->pcon_activated)
{ {
/* Send CSI6n just for requesting transfer input. */ if (GetStdHandle (STD_INPUT_HANDLE) == get_handle ())
{ /* Send CSI6n just for requesting transfer input. */
DWORD n; DWORD n;
WaitForSingleObject (input_mutex, INFINITE); WaitForSingleObject (input_mutex, INFINITE);
get_ttyp ()->req_xfer_input = true; get_ttyp ()->req_xfer_input = true;
@ -3092,6 +3093,7 @@ fhandler_pty_slave::setup_pseudoconsole (bool nopcon)
get_ttyp ()->pcon_start_pid = myself->pid; get_ttyp ()->pcon_start_pid = myself->pid;
WriteFile (get_output_handle_cyg (), "\033[6n", 4, &n, NULL); WriteFile (get_output_handle_cyg (), "\033[6n", 4, &n, NULL);
ReleaseMutex (input_mutex); ReleaseMutex (input_mutex);
}
/* Attach to the pseudo console which already exits. */ /* Attach to the pseudo console which already exits. */
pinfo p (get_ttyp ()->pcon_pid); pinfo p (get_ttyp ()->pcon_pid);
HANDLE pcon_owner = HANDLE pcon_owner =