The setting in terminal handling for both Unix style and
Windows was not ensuring that Ctrl-C character would
cause interrupt.

This is a first release bug. Testpmd interactive mode has
always disabled control-c handling on Linux.

Fixes: af75078fece3 ("first public release")
Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 lib/cmdline/cmdline_os_unix.c    | 3 ++-
 lib/cmdline/cmdline_os_windows.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/cmdline/cmdline_os_unix.c b/lib/cmdline/cmdline_os_unix.c
index 5f9839a15f98..356c5b3f3ca2 100644
--- a/lib/cmdline/cmdline_os_unix.c
+++ b/lib/cmdline/cmdline_os_unix.c
@@ -16,7 +16,8 @@ terminal_adjust(struct cmdline *cl)
        tcgetattr(0, &cl->oldterm);
 
        memcpy(&term, &cl->oldterm, sizeof(term));
-       term.c_lflag &= ~(ICANON | ECHO | ISIG);
+       term.c_lflag &= ~(ICANON | ECHO);
+       term.c_lflag |= ISIG;
        tcsetattr(0, TCSANOW, &term);
 
        setbuf(stdin, NULL);
diff --git a/lib/cmdline/cmdline_os_windows.c b/lib/cmdline/cmdline_os_windows.c
index 80863bfc8a00..8cff3b175747 100644
--- a/lib/cmdline/cmdline_os_windows.c
+++ b/lib/cmdline/cmdline_os_windows.c
@@ -32,10 +32,10 @@ terminal_adjust(struct cmdline *cl)
                mode &= ~(
                        ENABLE_LINE_INPUT |      /* no line buffering */
                        ENABLE_ECHO_INPUT |      /* no echo */
-                       ENABLE_PROCESSED_INPUT | /* pass Ctrl+C to program */
                        ENABLE_MOUSE_INPUT |     /* no mouse events */
                        ENABLE_WINDOW_INPUT);    /* no window resize events */
-               mode |= ENABLE_VIRTUAL_TERMINAL_INPUT;
+               mode |= ENABLE_VIRTUAL_TERMINAL_INPUT |
+                       ENABLE_PROCESSED_INPUT; /* Ctrl C processed by the 
system */
                SetConsoleMode(handle, mode);
        }
 
-- 
2.39.2

Reply via email to