From e5bb07874dfcb0e8018e07ac2468f79ec6a02042 Mon Sep 17 00:00:00 2001 From: apio Date: Mon, 7 Aug 2023 22:51:28 +0200 Subject: [PATCH] wind: Spawn a new client process after startup Also, create the socket after dropping privileges. --- wind/main.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/wind/main.cpp b/wind/main.cpp index cecb4a22..6df9d762 100644 --- a/wind/main.cpp +++ b/wind/main.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -45,9 +46,6 @@ Result luna_main(int argc, char** argv) auto screen = TRY(Screen::open()); - auto server = TRY(os::LocalServer::create(socket_path, false)); - TRY(server->listen(20)); - Mouse mouse_pointer { screen.canvas() }; ioctl(STDIN_FILENO, TTYSETGFX, 1); @@ -73,6 +71,12 @@ Result luna_main(int argc, char** argv) } } + auto server = TRY(os::LocalServer::create(socket_path, false)); + TRY(server->listen(20)); + + StringView args[] = { "/usr/bin/gclient"_sv }; + TRY(os::Process::spawn("/usr/bin/gclient"_sv, Slice { args, 1 }, false)); + ui::Color background = ui::BLACK; TRY(make(ui::Rect { 200, 200, 600, 400 }, ui::GREEN, "Calculator"_sv)); @@ -96,7 +100,7 @@ Result luna_main(int argc, char** argv) int rc = poll(fds, 3, 1000); if (!rc) continue; - if (rc < 0) { os::println("poll: error: %s", strerror(errno)); } + if (rc < 0 && errno != EINTR) { os::println("poll: error: %s", strerror(errno)); } if (fds[0].revents & POLLIN) {