public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/cygwin-3_3-branch] Cygwin: pty: Change the condition to send Ctrl-C event.
@ 2022-05-08 13:30 Takashi Yano
  0 siblings, 0 replies; only message in thread
From: Takashi Yano @ 2022-05-08 13:30 UTC (permalink / raw)
  To: cygwin-cvs

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

commit 8ff0657295c2f15461d628cb23774f729226c88e
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Sun May 8 22:04:38 2022 +0900

    Cygwin: pty: Change the condition to send Ctrl-C event.
    
    - Previously, non-cygwin app started by "script -c <non-cygwin app>"
      receives Ctrl-C twice. This patch fixes the issue.

Diff:
---
 winsup/cygwin/fhandler_termios.cc | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc
index 0bc360078..737bbea49 100644
--- a/winsup/cygwin/fhandler_termios.cc
+++ b/winsup/cygwin/fhandler_termios.cc
@@ -324,9 +324,6 @@ fhandler_termios::process_sigs (char c, tty* ttyp, fhandler_termios *fh)
   pid_t pgid = ttyp->pgid;
 
   /* The name *_nat stands for 'native' which means non-cygwin apps. */
-  pinfo leader (pgid);
-  bool cyg_leader = /* The process leader is a cygwin process. */
-    leader && !(leader->process_state & PID_NOTCYGWIN);
   bool ctrl_c_event_sent = false;
   bool need_discard_input = false;
   bool pg_with_nat = false; /* The process group has non-cygwin processes. */
@@ -385,9 +382,9 @@ fhandler_termios::process_sigs (char c, tty* ttyp, fhandler_termios *fh)
 	  if ((p->process_state & PID_NEW_PG)
 	      && (p->process_state & PID_NOTCYGWIN))
 	    GenerateConsoleCtrlEvent (CTRL_BREAK_EVENT, p->dwProcessId);
-	  else if ((!fh || fh->need_send_ctrl_c_event () || cyg_leader)
-		   && !ctrl_c_event_sent) /* cyg_leader is needed by GDB
-					     with non-cygwin inferior */
+	  else if ((!fh || fh->need_send_ctrl_c_event ()
+		    || p->exec_dwProcessId == p->dwProcessId)
+		   && !ctrl_c_event_sent)
 	    {
 	      GenerateConsoleCtrlEvent (CTRL_C_EVENT, 0);
 	      ctrl_c_event_sent = true;


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

only message in thread, other threads:[~2022-05-08 13:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-08 13:30 [newlib-cygwin/cygwin-3_3-branch] Cygwin: pty: Change the condition to send Ctrl-C event Takashi Yano

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).