From 56008869d6c7450ee0619ead31e6dea884143c1d Mon Sep 17 00:00:00 2001 From: Bananymous Date: Wed, 6 Dec 2023 13:04:33 +0200 Subject: [PATCH] Shell: Handle keyboard input that was interrupted by signal --- userspace/Shell/main.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/userspace/Shell/main.cpp b/userspace/Shell/main.cpp index 78b4b3cb..941db2ed 100644 --- a/userspace/Shell/main.cpp +++ b/userspace/Shell/main.cpp @@ -908,7 +908,19 @@ int main(int argc, char** argv) while (true) { - uint8_t ch = getchar(); + int chi = getchar(); + if (chi == EOF) + { + if (errno == EINTR) + { + clearerr(stdin); + continue; + } + perror("getchar"); + return 1; + } + + uint8_t ch = chi; if (waiting_utf8 > 0) {