aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash.c15
-rw-r--r--shell/shell_common.c9
2 files changed, 22 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 2a7941702..f23d63b21 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -14701,6 +14701,21 @@ readcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
14701 goto again; 14701 goto again;
14702 } 14702 }
14703 14703
14704#if ENABLE_PLATFORM_MINGW32
14705 if ((uintptr_t)r == 2) {
14706 /* ^C pressed, propagate event */
14707 if (iflag) {
14708 write(STDOUT_FILENO, "^C", 2);
14709 raise_interrupt();
14710 }
14711 else {
14712 GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
14713 exitshell();
14714 }
14715 return (uintptr_t)r;
14716 }
14717#endif
14718
14704 if ((uintptr_t)r > 1) 14719 if ((uintptr_t)r > 1)
14705 ash_msg_and_raise_error(r); 14720 ash_msg_and_raise_error(r);
14706 14721
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 320cd88fd..9092a8e2b 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -235,8 +235,13 @@ shell_builtin_read(struct builtin_read_params *params)
235 int64_t key; 235 int64_t key;
236 236
237 key = read_key(fd, NULL, timeout); 237 key = read_key(fd, NULL, timeout);
238 if (key == 0x03 || key == -1 || (key == 0x1a && bufpos == 0)) { 238 if (key == 0x03) {
239 /* ^C, timeout or ^Z at start of buffer */ 239 /* ^C pressed */
240 retval = (const char *)(uintptr_t)2;
241 goto ret;
242 }
243 else if (key == -1 || (key == 0x1a && bufpos == 0)) {
244 /* timeout or ^Z at start of buffer */
240 retval = (const char *)(uintptr_t)1; 245 retval = (const char *)(uintptr_t)1;
241 goto ret; 246 goto ret;
242 } 247 }