[cli] emit SIGINT on ctrl-c (#4502)

This commit emits SIGINT on ctrl-c so that gdb can work as expected.
This commit is contained in:
Yakun Xu
2020-01-23 08:42:22 -08:00
committed by Jonathan Hui
parent 1f9118834a
commit 0e051b1a27
+8
View File
@@ -36,6 +36,10 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#if OPENTHREAD_POSIX
#include <signal.h>
#include <sys/types.h>
#endif
#include <openthread/cli.h>
#include <openthread/platform/logging.h>
@@ -156,6 +160,10 @@ void Uart::ReceiveTask(const uint8_t *aBuf, uint16_t aBufLength)
#if !OPENTHREAD_CONFIG_UART_CLI_RAW
#if OPENTHREAD_POSIX
case 0x03: // ASCII for Ctrl-C
kill(0, SIGINT);
break;
case 0x04: // ASCII for Ctrl-D
exit(EXIT_SUCCESS);
break;