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.
This commit is contained in:
Bananymous 2023-10-24 19:10:53 +03:00
parent 988a4e1cd8
commit 1e2c2fb973
1 changed files with 2 additions and 2 deletions

View File

@ -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);