Commit 41e6325
Cygwin: console: re-enable the master thread before selecting cygwin input mode
When a cygwin program and a non-cygwin program run in the same foreground
process group (for example the pipeline `cat | ping`), Ctrl-C stopped
interrupting the cygwin program after "Cygwin: console: Ensure the master
thread runs only when it is supposed to".
The console only delivers Ctrl-C as a raw 0x03 byte (which the console
master thread reads and turns into a SIGINT for the foreground process
group) while that thread is live. When it is suspended or disabled,
set_input_mode (tty::cygwin) instead requests ENABLE_PROCESSED_INPUT,
so the console raises a CTRL_C_EVENT and the 0x03 byte never reaches
the master thread. The referenced commit reordered the two explicit
enable paths, bg_check () and post_open_setup (), and one path which
normally(*1) enables master thread, clearnup_for_non_cygwin_app(), so
that set_input_mode (tty::cygwin) runs while disable_master_thread is
still set; that leaves ENABLE_PROCESSED_INPUT on and the cygwin program
never receives its SIGINT.
(*1 ... except the process which calls exec() for non-cygwin app while
itself is the cons master. In this case, subsequent set_input_mode()
call sets the mode to tty::restore, and the master thread should be
kept 'disabled' until the process exits.)
Clear disable_master_thread before selecting cygwin input mode in those two
paths, so the mode is configured with the master thread already live and
ENABLE_PROCESSED_INPUT stays off. The disable paths and the synchronous
suspension that the referenced commit added are left unchanged, so
non-cygwin programs still get the master thread reliably suspended.
Fixes: 733d5a9 ("Cygwin: console: Ensure the master thread runs only when it is supposed to")
Assisted-by: Opus 4.8
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Co-Authored-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Reviewed-by: Takashi Yano <takashi.yano@nifty.ne.jp>1 parent 2047a73 commit 41e6325
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
991 | 991 | | |
992 | 992 | | |
993 | 993 | | |
| 994 | + | |
994 | 995 | | |
995 | 996 | | |
996 | 997 | | |
997 | 998 | | |
998 | 999 | | |
999 | 1000 | | |
1000 | 1001 | | |
1001 | | - | |
1002 | 1002 | | |
1003 | 1003 | | |
1004 | 1004 | | |
| |||
1191 | 1191 | | |
1192 | 1192 | | |
1193 | 1193 | | |
1194 | | - | |
1195 | 1194 | | |
| 1195 | + | |
1196 | 1196 | | |
1197 | 1197 | | |
1198 | 1198 | | |
| |||
2111 | 2111 | | |
2112 | 2112 | | |
2113 | 2113 | | |
2114 | | - | |
2115 | 2114 | | |
| 2115 | + | |
2116 | 2116 | | |
2117 | 2117 | | |
2118 | 2118 | | |
| |||
0 commit comments