Use signal, for linux

This commit is contained in:
Toby Jaffey 2025-12-09 22:20:11 +00:00
parent d5df056914
commit 428bd7cc6b

View file

@ -27,7 +27,7 @@ void cleanexit(int sig) {
void enableRawMode(void) {
tcgetattr(STDIN_FILENO, &orig_termios);
atexit(disableRawMode);
sigset(SIGINT, cleanexit);
signal(SIGINT, cleanexit);
struct termios raw = orig_termios;
raw.c_lflag &= ~(ECHO | ICANON | IEXTEN);
raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);