mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02:00
LanguageServers/Shell: Port to LibMain :^)
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 00:49:36 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c2b90bab9f0
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user