From b9d1ef99ded6a0003b761210f4b08c99527966af Mon Sep 17 00:00:00 2001 From: Spencer Dixon Date: Mon, 21 Jun 2021 20:27:02 -0400 Subject: [PATCH] Assistant+Taskbar: Use AppFile::spawn() utility --- Userland/Applications/Assistant/main.cpp | 1 - Userland/Services/Taskbar/TaskbarWindow.cpp | 23 ++------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/Userland/Applications/Assistant/main.cpp b/Userland/Applications/Assistant/main.cpp index 22e33c397f..3c4c57b24d 100644 --- a/Userland/Applications/Assistant/main.cpp +++ b/Userland/Applications/Assistant/main.cpp @@ -121,7 +121,6 @@ public: void search(String const& query) { - m_app_provider.query(query, [=, this](auto results) { recv_results(query, results); }); diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp index 739249de69..50a2ae7be6 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.cpp +++ b/Userland/Services/Taskbar/TaskbarWindow.cpp @@ -331,27 +331,8 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event) case GUI::Event::WM_SuperSpaceKeyPressed: { auto af_path = String::formatted("{}/{}", Desktop::AppFile::APP_FILES_DIRECTORY, "Assistant.af"); auto af = Desktop::AppFile::open(af_path); - if (!af->is_valid()) { - warnln("invalid app file when trying to open Assistant"); - return; - } - auto app_executable = af->executable(); - - pid_t pid = fork(); - if (pid < 0) { - perror("fork"); - } else if (pid == 0) { - if (chdir(Core::StandardPaths::home_directory().characters()) < 0) { - perror("chdir"); - exit(1); - } - execl(app_executable.characters(), app_executable.characters(), nullptr); - perror("execl"); - VERIFY_NOT_REACHED(); - } else { - if (disown(pid) < 0) - perror("disown"); - } + if (!af->spawn()) + warnln("failed to spawn 'Assistant' when requested via Super+Space"); break; } default: