Cygwin: console: Restore CTRL_BREAK_EVENT handling.
- The recent change by the commit "Cygwin: console: Redesign handling of special keys." breaks the handling of CTRL_BREAK_EVENT. The login shell in console exits on Ctrl-Break key. This patch fixes the issue.
This commit is contained in:
parent
acf642177b
commit
5c4a0824e7
|
@ -1146,6 +1146,11 @@ ctrl_c_handler (DWORD type)
|
||||||
if (!pinfo (cygwin_pid (GetCurrentProcessId ())))
|
if (!pinfo (cygwin_pid (GetCurrentProcessId ())))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
if (type == CTRL_C_EVENT && ::cygheap->ctty
|
||||||
|
&& !cygheap->ctty->need_console_handler ())
|
||||||
|
/* Ctrl-C is handled in fhandler_console::cons_master_thread(). */
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
tty_min *t = cygwin_shared->tty.get_cttyp ();
|
tty_min *t = cygwin_shared->tty.get_cttyp ();
|
||||||
|
|
||||||
/* If process group leader is non-cygwin process or not exist,
|
/* If process group leader is non-cygwin process or not exist,
|
||||||
|
@ -1169,14 +1174,8 @@ ctrl_c_handler (DWORD type)
|
||||||
(to indicate that we have handled the signal). At this point, type
|
(to indicate that we have handled the signal). At this point, type
|
||||||
should be a CTRL_C_EVENT or CTRL_BREAK_EVENT. */
|
should be a CTRL_C_EVENT or CTRL_BREAK_EVENT. */
|
||||||
{
|
{
|
||||||
int sig = SIGINT;
|
|
||||||
/* If intr and quit are both mapped to ^C, send SIGQUIT on ^BREAK */
|
|
||||||
if (type == CTRL_BREAK_EVENT
|
|
||||||
&& t->ti.c_cc[VINTR] == 3 && t->ti.c_cc[VQUIT] == 3)
|
|
||||||
sig = SIGQUIT;
|
|
||||||
t->last_ctrl_c = GetTickCount64 ();
|
t->last_ctrl_c = GetTickCount64 ();
|
||||||
t->kill_pgrp (sig);
|
fhandler_termios::process_sigs ('\003', (tty *) t, ::cygheap->ctty);
|
||||||
t->output_stopped = false;
|
|
||||||
t->last_ctrl_c = GetTickCount64 ();
|
t->last_ctrl_c = GetTickCount64 ();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -699,11 +699,7 @@ fhandler_console::bg_check (int sig, bool dontsignal)
|
||||||
if (sig == SIGTTIN)
|
if (sig == SIGTTIN)
|
||||||
{
|
{
|
||||||
set_input_mode (tty::cygwin, &tc ()->ti, get_handle_set ());
|
set_input_mode (tty::cygwin, &tc ()->ti, get_handle_set ());
|
||||||
if (con.disable_master_thread)
|
con.disable_master_thread = false;
|
||||||
{
|
|
||||||
con.disable_master_thread = false;
|
|
||||||
init_console_handler (false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (sig == SIGTTOU)
|
if (sig == SIGTTOU)
|
||||||
set_output_mode (tty::cygwin, &tc ()->ti, get_handle_set ());
|
set_output_mode (tty::cygwin, &tc ()->ti, get_handle_set ());
|
||||||
|
@ -1406,7 +1402,8 @@ bool
|
||||||
fhandler_console::open_setup (int flags)
|
fhandler_console::open_setup (int flags)
|
||||||
{
|
{
|
||||||
set_flags ((flags & ~O_TEXT) | O_BINARY);
|
set_flags ((flags & ~O_TEXT) | O_BINARY);
|
||||||
myself->set_ctty (this, flags);
|
if (myself->set_ctty (this, flags) && !myself->cygstarted)
|
||||||
|
init_console_handler (true);
|
||||||
return fhandler_base::open_setup (flags);
|
return fhandler_base::open_setup (flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1422,8 +1419,6 @@ fhandler_console::post_open_setup (int fd)
|
||||||
else if (fd == 1 || fd == 2)
|
else if (fd == 1 || fd == 2)
|
||||||
set_output_mode (tty::cygwin, &get_ttyp ()->ti, &handle_set);
|
set_output_mode (tty::cygwin, &get_ttyp ()->ti, &handle_set);
|
||||||
|
|
||||||
init_console_handler (need_console_handler ());
|
|
||||||
|
|
||||||
fhandler_base::post_open_setup (fd);
|
fhandler_base::post_open_setup (fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1392,8 +1392,7 @@ wait_sig (VOID *)
|
||||||
sig_held = true;
|
sig_held = true;
|
||||||
break;
|
break;
|
||||||
case __SIGSETPGRP:
|
case __SIGSETPGRP:
|
||||||
if (::cygheap->ctty)
|
init_console_handler (true);
|
||||||
init_console_handler (::cygheap->ctty->need_console_handler ());
|
|
||||||
break;
|
break;
|
||||||
case __SIGTHREADEXIT:
|
case __SIGTHREADEXIT:
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue