From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin-patches@cygwin.com
Subject: [PATCH] Cygwin: pty: Transfer input for native app only if the stdin is pcon.
Date: Mon, 8 Mar 2021 23:55:10 +0900 [thread overview]
Message-ID: <20210308145510.1164-1-takashi.yano@nifty.ne.jp> (raw)
- 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 | 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 =
--
2.30.1
next reply other threads:[~2021-03-08 14:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-08 14:55 Takashi Yano [this message]
2021-03-08 15:32 ` Corinna Vinschen
2021-03-08 15:48 ` Takashi Yano
2021-03-08 20:52 ` Corinna Vinschen
2021-03-09 3:22 ` Takashi Yano
2021-03-09 9:23 ` Corinna Vinschen
2021-03-08 15:33 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210308145510.1164-1-takashi.yano@nifty.ne.jp \
--to=takashi.yano@nifty.ne.jp \
--cc=cygwin-patches@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).