diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2022-02-15 17:23:50 +0300 |
---|---|---|
committer | Takashi Yano <takashi.yano@nifty.ne.jp> | 2022-02-20 13:21:51 +0300 |
commit | 2cab4d0bb4af5ad7ec97914068d5fa1b8954909c (patch) | |
tree | e6c43b64c1c7c6d979ec87c4c737bf01cd0b9190 /winsup/cygwin/exceptions.cc | |
parent | 416792d59a660d45cbfe822392bc9be0bf9da966 (diff) |
Cygwin: pty, console: Refactor the code processing special keys.
- This patch commonize the code which processes special keys in pty
and console to improve maintanancibility. As a result, some small
bugs have been fixed.
Diffstat (limited to 'winsup/cygwin/exceptions.cc')
-rw-r--r-- | winsup/cygwin/exceptions.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index a914110fe..356d69d6a 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1147,6 +1147,19 @@ ctrl_c_handler (DWORD type) return TRUE; tty_min *t = cygwin_shared->tty.get_cttyp (); + + /* If process group leader is non-cygwin process or not exist, + send signal to myself. */ + pinfo pi (t->getpgid ()); + if ((!pi || (pi->process_state & PID_NOTCYGWIN)) + && (!have_execed || have_execed_cygwin) + && t->getpgid () == myself->pgid + && type == CTRL_C_EVENT) + { + t->output_stopped = false; + sig_send(myself, SIGINT); + } + /* Ignore this if we're not the process group leader since it should be handled *by* the process group leader. */ if (t && (!have_execed || have_execed_cygwin) @@ -1556,6 +1569,8 @@ dosig: if (have_execed) { sigproc_printf ("terminating captive process"); + if (::cygheap->ctty) + ::cygheap->ctty->cleanup_before_exit (); TerminateProcess (ch_spawn, sigExeced = si.si_signo); } /* Dispatch to the appropriate function. */ |