mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 04:17:34 +00:00
LanguageServers/Shell: Port to LibMain :^)
This commit is contained in:
parent
54155f8c64
commit
c2b90bab9f
2 changed files with 7 additions and 18 deletions
|
@ -16,4 +16,4 @@ serenity_bin(ShellLanguageServer)
|
||||||
|
|
||||||
# We link with LibGUI because we use GUI::TextDocument to update
|
# We link with LibGUI because we use GUI::TextDocument to update
|
||||||
# the content of files according to the edit actions we receive over IPC.
|
# 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)
|
||||||
|
|
|
@ -5,32 +5,21 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ClientConnection.h"
|
#include "ClientConnection.h"
|
||||||
#include <AK/LexicalPath.h>
|
|
||||||
#include <LibCore/EventLoop.h>
|
#include <LibCore/EventLoop.h>
|
||||||
#include <LibCore/File.h>
|
|
||||||
#include <LibCore/LocalServer.h>
|
#include <LibCore/LocalServer.h>
|
||||||
#include <LibIPC/ClientConnection.h>
|
#include <LibIPC/ClientConnection.h>
|
||||||
#include <sys/stat.h>
|
#include <LibMain/Main.h>
|
||||||
#include <unistd.h>
|
#include <LibSystem/Wrappers.h>
|
||||||
|
|
||||||
int main(int, char**)
|
ErrorOr<int> serenity_main(Main::Arguments)
|
||||||
{
|
{
|
||||||
Core::EventLoop event_loop;
|
Core::EventLoop event_loop;
|
||||||
if (pledge("stdio unix rpath recvfd", nullptr) < 0) {
|
TRY(System::pledge("stdio unix rpath recvfd", nullptr));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server();
|
auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server();
|
||||||
IPC::new_client_connection<LanguageServers::Shell::ClientConnection>(socket.release_nonnull(), 1);
|
IPC::new_client_connection<LanguageServers::Shell::ClientConnection>(socket.release_nonnull(), 1);
|
||||||
if (pledge("stdio rpath recvfd", nullptr) < 0) {
|
TRY(System::pledge("stdio rpath recvfd", nullptr));
|
||||||
perror("pledge");
|
TRY(System::unveil("/etc/passwd", "r"));
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (unveil("/etc/passwd", "r") < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return event_loop.exec();
|
return event_loop.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue