diff --git a/Userland/sh.cpp b/Userland/sh.cpp index 2f79c93ffd9..6e5884c2fa9 100644 --- a/Userland/sh.cpp +++ b/Userland/sh.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -291,6 +292,9 @@ static int runcmd(char* cmd) return 0; } + struct termios trm; + tcgetattr(0, &trm); + pid_t child = fork(); if (!child) { setpgid(0, 0); @@ -318,6 +322,8 @@ static int runcmd(char* cmd) // Is the terminal controlling pgrp really still the PGID of the dead process? tcsetpgrp(0, getpid()); + tcsetattr(0, TCSANOW, &trm); + if (WIFEXITED(wstatus)) { if (WEXITSTATUS(wstatus) != 0) printf("Exited with status %d\n", WEXITSTATUS(wstatus));