From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id D626D3844047; Mon, 8 Mar 2021 15:34:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D626D3844047 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pty: Transfer input for native app only if the stdin is pcon. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano via Cygwin-patches X-Git-Refname: refs/heads/master X-Git-Oldrev: a9ff2cad68fa38d002b50e28e510c192beec787f X-Git-Newrev: 12325677f73a540d1e515cfc742395c2716d8964 Message-Id: <20210308153410.D626D3844047@sourceware.org> Date: Mon, 8 Mar 2021 15:34:10 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 15:34:10 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=12325677f73a540d1e515cfc742395c2716d8964 commit 12325677f73a540d1e515cfc742395c2716d8964 Author: Takashi Yano via Cygwin-patches 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 =