From 50092ea0ca37f0818d07c25651f2b5ad0f0acc2a Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Sun, 31 Jan 2021 07:24:41 +0000 Subject: [PATCH] Inspector: Exit if inspected process has not pledged accept --- Userland/DevTools/Inspector/main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Userland/DevTools/Inspector/main.cpp b/Userland/DevTools/Inspector/main.cpp index 0a4fec645f..b3234f536a 100644 --- a/Userland/DevTools/Inspector/main.cpp +++ b/Userland/DevTools/Inspector/main.cpp @@ -28,10 +28,12 @@ #include "RemoteObjectGraphModel.h" #include "RemoteObjectPropertyModel.h" #include "RemoteProcess.h" +#include #include #include #include #include +#include #include #include #include @@ -98,6 +100,20 @@ int main(int argc, char** argv) } auto window = GUI::Window::construct(); + + auto all_processes = Core::ProcessStatisticsReader::get_all(); + for (auto& it : all_processes.value()) { + if (it.value.pid != pid) + continue; + if (it.value.pledge.is_empty()) + break; + if (!it.value.pledge.contains("accept")) { + GUI::MessageBox::show(window, String::formatted("{} ({}) has not pledged accept!", it.value.name, pid), "Error", GUI::MessageBox::Type::Error); + return 1; + } + break; + } + window->set_title("Inspector"); window->resize(685, 500); window->set_icon(app_icon.bitmap_for_size(16));