From b5b67a1747cf8dd84d7f2f989aecdb069ac619c4 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sat, 7 Aug 2021 03:10:45 -0700 Subject: [PATCH] SystemServer: Handle missing service executable gracefully I use the `configure-components` functionality locally during development. There are a few services (SpiceAgent) which aren't marked as required components, and hence aren't built in all configurations, but we still try to launch them in all configurations. Instead of letting the forked SystemServer process crash, lets gracefully handle the situation of a missing binary and provide a message to the user. --- Userland/Services/SystemServer/Service.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/Services/SystemServer/Service.cpp b/Userland/Services/SystemServer/Service.cpp index 997f84902c..fca83b283a 100644 --- a/Userland/Services/SystemServer/Service.cpp +++ b/Userland/Services/SystemServer/Service.cpp @@ -131,6 +131,11 @@ void Service::activate() void Service::spawn(int socket_fd) { + if (!Core::File::exists(m_executable_path)) { + dbgln("{}: binary \"{}\" does not exist, skipping service.", name(), m_executable_path); + return; + } + dbgln_if(SERVICE_DEBUG, "Spawning {}", name()); m_run_timer.start();