Re: [PATCH 2/3] Cygwin: console: Fix NOFLSH mode a little
Mark Geisert <[email protected]> Wed, 24 Jun 2026 01:04:14 -0700
| Newsgroups | gmane.os.cygwin.patches |
|---|---|
| Message-ID | <[email protected]> |
Hi Takashi,
This patch LGTM. OK to push.
..mark
On 6/10/2026 9:35 AM, Takashi Yano wrote:
> If you run "stty noflsh; cat" in "bash", and stop "cat" by Ctrl-C,
> a stray ^C is passed to "bash". The current code calls tcflush() if
> NOFLSH is not set, however, tcflush() is not called when NOFLSH is
> set. So, Ctrl-C remains in console input buffer. This should be
> discarded even in NOFLSH mode. This patch introduces a helper
> function discard_key_events() and call it to erase Ctrl-C in the
> console input buffer.
>
> Note that even with this patch, NOFLSH is not fully functional in
> console because the readahead buffer is unique to process, so it
> cannot be inherited to other processes. However, it should work
> intra process.
>
> Fixes: 118e51be1d04 ("(tty_min::kill_pgrp): Handle tty flush when signal detected.")
> Signed-off-by: Takashi Yano <[email protected]>
> Reviewed-by:
> ---
> winsup/cygwin/fhandler/console.cc | 20 +++++++++++++++++---
> winsup/cygwin/fhandler/termios.cc | 10 +++++++---
> winsup/cygwin/local_includes/fhandler.h | 2 ++
> 3 files changed, 26 insertions(+), 6 deletions(-)
[...]