diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-23 10:37:38 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-23 11:33:36 +0100 |
commit | c2b90bab9f09d877af55516b6628075ab1cfd77b (patch) | |
tree | 69f35e7bc4d58e074cd880d9bf96776845ef190f | |
parent | 54155f8c64600890d30539d728d1e188a087e678 (diff) | |
download | serenity-c2b90bab9f09d877af55516b6628075ab1cfd77b.zip |
LanguageServers/Shell: Port to LibMain :^)
-rw-r--r-- | Userland/DevTools/HackStudio/LanguageServers/Shell/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/LanguageServers/Shell/main.cpp | 23 |
2 files changed, 7 insertions, 18 deletions
diff --git a/Userland/DevTools/HackStudio/LanguageServers/Shell/CMakeLists.txt b/Userland/DevTools/HackStudio/LanguageServers/Shell/CMakeLists.txt index 59563e9a40..246f7e42d4 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Shell/CMakeLists.txt +++ b/Userland/DevTools/HackStudio/LanguageServers/Shell/CMakeLists.txt @@ -16,4 +16,4 @@ serenity_bin(ShellLanguageServer) # We link with LibGUI because we use GUI::TextDocument to update # the content of files according to the edit actions we receive over IPC. -target_link_libraries(ShellLanguageServer LibIPC LibShell LibGUI LibLanguageServer) +target_link_libraries(ShellLanguageServer LibIPC LibShell LibGUI LibLanguageServer LibMain) diff --git a/Userland/DevTools/HackStudio/LanguageServers/Shell/main.cpp b/Userland/DevTools/HackStudio/LanguageServers/Shell/main.cpp index 5d47c1e640..be46401579 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Shell/main.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Shell/main.cpp @@ -5,32 +5,21 @@ */ #include "ClientConnection.h" -#include <AK/LexicalPath.h> #include <LibCore/EventLoop.h> -#include <LibCore/File.h> #include <LibCore/LocalServer.h> #include <LibIPC/ClientConnection.h> -#include <sys/stat.h> -#include <unistd.h> +#include <LibMain/Main.h> +#include <LibSystem/Wrappers.h> -int main(int, char**) +ErrorOr<int> serenity_main(Main::Arguments) { Core::EventLoop event_loop; - if (pledge("stdio unix rpath recvfd", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(System::pledge("stdio unix rpath recvfd", nullptr)); auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server(); IPC::new_client_connection<LanguageServers::Shell::ClientConnection>(socket.release_nonnull(), 1); - if (pledge("stdio rpath recvfd", nullptr) < 0) { - perror("pledge"); - return 1; - } - if (unveil("/etc/passwd", "r") < 0) { - perror("unveil"); - return 1; - } + TRY(System::pledge("stdio rpath recvfd", nullptr)); + TRY(System::unveil("/etc/passwd", "r")); return event_loop.exec(); } |