1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

LibCore: Make LocalServer::take_over_from_system_server() return ErrorOr

This allows us to use TRY() or MUST() when calling it.
This commit is contained in:
Andreas Kling 2021-12-06 16:27:57 +01:00
parent 229a45ab14
commit 81047d8f9c
13 changed files with 41 additions and 53 deletions

View file

@ -19,8 +19,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
TRY(Core::System::pledge("stdio unix accept"));
bool ok = server->take_over_from_system_server("/tmp/portal/inspector");
VERIFY(ok);
TRY(server->take_over_from_system_server("/tmp/portal/inspector"));
server->on_accept = [&](auto client_socket) {
static int s_next_client_id = 0;
int client_id = ++s_next_client_id;
@ -28,8 +27,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
};
auto inspectables_server = TRY(Core::LocalServer::try_create());
if (!inspectables_server->take_over_from_system_server("/tmp/portal/inspectables"))
VERIFY_NOT_REACHED();
TRY(inspectables_server->take_over_from_system_server("/tmp/portal/inspectables"));
inspectables_server->on_accept = [&](auto client_socket) {
auto pid = client_socket->peer_pid();