]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: pty: Transfer input for native app only if the stdin is pcon.
authorTakashi Yano via Cygwin-patches <cygwin-patches@cygwin.com>
Mon, 8 Mar 2021 14:55:10 +0000 (23:55 +0900)
committerCorinna Vinschen <corinna@vinschen.de>
Mon, 8 Mar 2021 15:33:53 +0000 (16:33 +0100)
- 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.

winsup/cygwin/fhandler_tty.cc

index 3bfc8c0c8e1aa6b70bb4ef5dbf8651bd33b0f3b1..47d59e8c5506241653d83fb7e9ab5b50ec6c73d9 100644 (file)
@@ -3084,14 +3084,16 @@ fhandler_pty_slave::setup_pseudoconsole (bool nopcon)
   if (get_ttyp ()->pcon_pid && get_ttyp ()->pcon_pid != myself->pid
       && !!pinfo (get_ttyp ()->pcon_pid) && get_ttyp ()->pcon_activated)
     {
-      /* Send CSI6n just for requesting transfer input. */
-      DWORD n;
-      WaitForSingleObject (input_mutex, INFINITE);
-      get_ttyp ()->req_xfer_input = true;
-      get_ttyp ()->pcon_start = true;
-      get_ttyp ()->pcon_start_pid = myself->pid;
-      WriteFile (get_output_handle_cyg (), "\033[6n", 4, &n, NULL);
-      ReleaseMutex (input_mutex);
+      if (GetStdHandle (STD_INPUT_HANDLE) == get_handle ())
+       { /* Send CSI6n just for requesting transfer input. */
+         DWORD n;
+         WaitForSingleObject (input_mutex, INFINITE);
+         get_ttyp ()->req_xfer_input = true;
+         get_ttyp ()->pcon_start = true;
+         get_ttyp ()->pcon_start_pid = myself->pid;
+         WriteFile (get_output_handle_cyg (), "\033[6n", 4, &n, NULL);
+         ReleaseMutex (input_mutex);
+       }
       /* Attach to the pseudo console which already exits. */
       pinfo p (get_ttyp ()->pcon_pid);
       HANDLE pcon_owner =
This page took 0.035743 seconds and 5 git commands to generate.