summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-04-16 17:09:34 +0100
committerAndreas Kling <kling@serenityos.org>2022-04-18 12:57:34 +0200
commitf240def4145c378e12255cfafba086c89659fc1d (patch)
tree40dc60c1d5e3d0cb2530d2448987869f23f88119 /Userland/Libraries/LibCore
parentd20ff6c89151641dd454bcdeb139083d401cdad7 (diff)
downloadserenity-f240def4145c378e12255cfafba086c89659fc1d.zip
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.
Diffstat (limited to 'Userland/Libraries/LibCore')
-rw-r--r--Userland/Libraries/LibCore/EventLoop.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/Userland/Libraries/LibCore/EventLoop.cpp b/Userland/Libraries/LibCore/EventLoop.cpp
index 0c79cce1d5..e9f8e98b4c 100644
--- a/Userland/Libraries/LibCore/EventLoop.cpp
+++ b/Userland/Libraries/LibCore/EventLoop.cpp
@@ -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
}