unix: Properly cancel REPL input when Ctrl-C is pressed.

This commit is contained in:
Damien George 2015-12-22 22:06:09 +00:00
parent 401af50dc0
commit e9751d2ac0
1 changed files with 5 additions and 1 deletions

View File

@ -176,7 +176,11 @@ STATIC int do_repl(void) {
int ret = readline(&line, ">>> ");
mp_parse_input_kind_t parse_input_kind = MP_PARSE_SINGLE_INPUT;
if (ret == CHAR_CTRL_D) {
if (ret == CHAR_CTRL_C) {
// cancel input
mp_hal_stdout_tx_str("\r\n");
goto input_restart;
} else if (ret == CHAR_CTRL_D) {
// EOF
printf("\n");
mp_hal_stdio_mode_orig();