summaryrefslogtreecommitdiff
path: root/userland/terminal/term.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-03-26 11:40:39 +0100
committerAnton Kling <anton@kling.gg>2024-03-26 11:40:39 +0100
commit297231bb3602d868d3891d357026c53f9fcc2402 (patch)
tree6c4f21db84912750f6f464b26bf1e4503d1fe479 /userland/terminal/term.c
parent3deb2df8e62a5f0a5535ee734a5aa13b0959f53f (diff)
Increase support for signals
Diffstat (limited to 'userland/terminal/term.c')
-rw-r--r--userland/terminal/term.c16
1 files changed, 10 insertions, 6 deletions
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 <libgui.h>
#include <poll.h>
#include <pty.h>
+#include <signal.h>
#include <socket.h>
#include <stddef.h>
#include <stdint.h>
@@ -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;
}