public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: pty: Transfer input for native app only if the stdin is pcon.
@ 2021-03-08 15:34 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2021-03-08 15:34 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=12325677f73a540d1e515cfc742395c2716d8964

commit 12325677f73a540d1e515cfc742395c2716d8964
Author: Takashi Yano via Cygwin-patches <cygwin-patches@cygwin.com>
Date:   Mon Mar 8 23:55:10 2021 +0900

    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.

Diff:
---
 winsup/cygwin/fhandler_tty.cc | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 3bfc8c0c8..47d59e8c5 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -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 =


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-08 15:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08 15:34 [newlib-cygwin] Cygwin: pty: Transfer input for native app only if the stdin is pcon Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).