From 297231bb3602d868d3891d357026c53f9fcc2402 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Tue, 26 Mar 2024 11:40:39 +0100 Subject: Increase support for signals --- userland/terminal/term.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'userland/terminal') diff --git a/userland/terminal/term.c b/userland/terminal/term.c index 4824a59..cd75a90 100644 --- a/userland/terminal/term.c +++ b/userland/terminal/term.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -19,6 +20,8 @@ uint32_t screen_pos_x = 0; uint32_t screen_pos_y = 0; int serial_fd; +int shell_pid; + int raw_mode = 0; void execsh(void) { @@ -98,8 +101,8 @@ void newtty(void) { int m; int s; openpty(&m, &s, NULL, NULL, NULL); - int pid = fork(); - if (0 == pid) { + shell_pid = fork(); + if (0 == shell_pid) { close(global_w->ws_socket); close(global_w->bitmap_fd); dup2(s, 0); @@ -246,13 +249,14 @@ void run() { } if (WINDOWSERVER_EVENT_WINDOW_EXIT == e.type) { close(global_w->ws_socket); + kill(shell_pid, SIGTERM); exit(0); return; } -// if (WINDOWSERVER_EVENT_WINDOW_RESIZE == e.type) { -// GUI_Resize(global_w, e.vector[0], e.vector[1]); -// continue; -// } + // if (WINDOWSERVER_EVENT_WINDOW_RESIZE == e.type) { + // GUI_Resize(global_w, e.vector[0], e.vector[1]); + // continue; + // } if (WINDOWSERVER_EVENT_KEYPRESS != e.type) { continue; } -- cgit v1.2.3