[v3,3/3] testpmd: enable interrupt in interactive mode
Checks
Commit Message
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 <stephen@networkplumber.org>
---
lib/cmdline/cmdline_os_unix.c | 3 ++-
lib/cmdline/cmdline_os_windows.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
@@ -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);
@@ -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);
}