ash,hush: make ^C in interactive mode visually much closer to bash behavior

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2016-11-25 03:41:03 +01:00
parent 24860fa09c
commit 4b89d512b1
3 changed files with 15 additions and 8 deletions

View File

@@ -9869,7 +9869,8 @@ preadfd(void)
reinit_unicode_for_ash();
nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ, timeout);
if (nr == 0) {
/* Ctrl+C pressed */
/* ^C pressed, "convert" to SIGINT */
write(STDOUT_FILENO, "^C", 2);
if (trap[SIGINT]) {
buf[0] = '\n';
buf[1] = '\0';
@@ -9877,6 +9878,7 @@ preadfd(void)
return 1;
}
exitstatus = 128 + SIGINT;
bb_putchar('\n');
goto retry;
}
if (nr < 0) {