1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:27:45 +00:00

LibCore: Allow inspecting any process launched with MAKE_INSPECTABLE=1

For now, EventLoop and Application still have a make_inspectable
parameter, so that when working on an application you can temporarily
hard-code it to be inspectable rather than having to set the env var
each time.
This commit is contained in:
Sam Atkins 2022-04-16 17:09:34 +01:00 committed by Andreas Kling
parent d20ff6c891
commit f240def414
2 changed files with 12 additions and 7 deletions

View file

@ -330,12 +330,16 @@ EventLoop::EventLoop([[maybe_unused]] MakeInspectable make_inspectable)
s_event_loop_stack->append(*this);
#ifdef __serenity__
if (getuid() != 0
&& make_inspectable == MakeInspectable::Yes
// FIXME: Deadlock potential; though the main loop and inspector server connection are rarely used in conjunction
&& !s_inspector_server_connection.with_locked([](auto inspector_server_connection) { return inspector_server_connection; })) {
if (!connect_to_inspector_server())
dbgln("Core::EventLoop: Failed to connect to InspectorServer");
if (getuid() != 0) {
if (getenv("MAKE_INSPECTABLE") == "1"sv)
make_inspectable = Core::EventLoop::MakeInspectable::Yes;
if (make_inspectable == MakeInspectable::Yes
// FIXME: Deadlock potential; though the main loop and inspector server connection are rarely used in conjunction
&& !s_inspector_server_connection.with_locked([](auto inspector_server_connection) { return inspector_server_connection; })) {
if (!connect_to_inspector_server())
dbgln("Core::EventLoop: Failed to connect to InspectorServer");
}
}
#endif
}