summaryrefslogtreecommitdiffstats
path: root/chardev/char-win-stdio.c
diff options
context:
space:
mode:
authorBin Meng2022-10-25 16:10:15 +0200
committerMarc-André Lureau2022-11-21 08:30:11 +0100
commit06639f8ff53d1dbfa709377499e6c30eca9c3c9a (patch)
treef3c1bb67b21259a2daeab05b3a8a9a6ca271db29 /chardev/char-win-stdio.c
parentMerge tag 'pull-ppc-20221117' of https://gitlab.com/danielhb/qemu into staging (diff)
downloadqemu-06639f8ff53d1dbfa709377499e6c30eca9c3c9a.tar.gz
qemu-06639f8ff53d1dbfa709377499e6c30eca9c3c9a.tar.xz
qemu-06639f8ff53d1dbfa709377499e6c30eca9c3c9a.zip
chardev/char-win-stdio: Pass Ctrl+C to guest with a multiplexed monitor
At present when pressing Ctrl+C from a guest running on QEMU Windows with a multiplexed monitor, e.g.: -serial mon:stdio, QEMU executable just exits. This behavior is inconsistent with the Linux version. Such behavior is caused by unconditionally setting the input mode ENABLE_PROCESSED_INPUT for a console's input buffer. Fix this by testing whether the chardev is allowed to do so. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20221025141015.612291-1-bin.meng@windriver.com>
Diffstat (limited to 'chardev/char-win-stdio.c')
-rw-r--r--chardev/char-win-stdio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/chardev/char-win-stdio.c b/chardev/char-win-stdio.c
index a4771ab82e..eb830eabd9 100644
--- a/chardev/char-win-stdio.c
+++ b/chardev/char-win-stdio.c
@@ -146,6 +146,8 @@ static void qemu_chr_open_stdio(Chardev *chr,
bool *be_opened,
Error **errp)
{
+ ChardevStdio *opts = backend->u.stdio.data;
+ bool stdio_allow_signal = !opts->has_signal || opts->signal;
WinStdioChardev *stdio = WIN_STDIO_CHARDEV(chr);
DWORD dwMode;
int is_console = 0;
@@ -193,7 +195,11 @@ static void qemu_chr_open_stdio(Chardev *chr,
if (is_console) {
/* set the terminal in raw mode */
/* ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS */
- dwMode |= ENABLE_PROCESSED_INPUT;
+ if (stdio_allow_signal) {
+ dwMode |= ENABLE_PROCESSED_INPUT;
+ } else {
+ dwMode &= ~ENABLE_PROCESSED_INPUT;
+ }
}
SetConsoleMode(stdio->hStdIn, dwMode);