Shell: Use sigaction instead of signal

This allows ctrl-c to work on linux :D
This commit is contained in:
Bananymous 2024-10-05 19:05:04 +03:00
parent f709e88994
commit e302b6b635
1 changed files with 8 additions and 4 deletions

View File

@ -780,10 +780,14 @@ int main(int argc, char** argv)
{ {
realpath(argv[0], s_shell_path); realpath(argv[0], s_shell_path);
if (signal(SIGINT, [](int) {}) == SIG_ERR) struct sigaction sa;
perror("signal"); sa.sa_flags = 0;
if (signal(SIGTTOU, SIG_IGN) == SIG_ERR)
perror("signal"); sa.sa_handler = [](int) {};
sigaction(SIGINT, &sa, nullptr);
sa.sa_handler = SIG_IGN;
sigaction(SIGTTOU, &sa, nullptr);
tcgetattr(0, &old_termios); tcgetattr(0, &old_termios);