From 07f8c972b3e9275efa90746cc0448b62a15cf6e6 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 24 Oct 2023 19:10:53 +0300 Subject: [PATCH] Shell: Set get old termios earlier I sourced the config file before getting old termios. Sourcing updated the termios so old_termios was always in non canonical, non echoing mode. --- userspace/Shell/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/userspace/Shell/main.cpp b/userspace/Shell/main.cpp index 7dd3f939..4dd8b411 100644 --- a/userspace/Shell/main.cpp +++ b/userspace/Shell/main.cpp @@ -833,6 +833,8 @@ int main(int argc, char** argv) if (signal(SIGINT, [](int) {}) == SIG_ERR) perror("signal"); + tcgetattr(0, &old_termios); + { FILE* fp = fopen("/etc/hostname", "r"); if (fp != NULL) @@ -876,8 +878,6 @@ int main(int argc, char** argv) source_shellrc(); - tcgetattr(0, &old_termios); - new_termios = old_termios; new_termios.c_lflag &= ~(ECHO | ICANON); tcsetattr(0, TCSANOW, &new_termios);