From b81a3a6f0ece026a2cb3ec62d28e0d3dd12aabd8 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Sat, 2 Apr 2022 13:54:22 +0100 Subject: [PATCH] profile: Use Core::System::exec() --- Userland/Utilities/profile.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Userland/Utilities/profile.cpp b/Userland/Utilities/profile.cpp index 35fafcbcca..d4e2800038 100644 --- a/Userland/Utilities/profile.cpp +++ b/Userland/Utilities/profile.cpp @@ -107,20 +107,11 @@ ErrorOr serenity_main(Main::Arguments arguments) return 0; } - auto cmd_parts = String(cmd_argument).split(' '); - Vector cmd_argv; - - for (auto& part : cmd_parts) - cmd_argv.append(part.characters()); - - cmd_argv.append(nullptr); + auto cmd_parts = String(cmd_argument).split_view(' '); dbgln("Enabling profiling for PID {}", getpid()); TRY(Core::System::profiling_enable(getpid(), event_mask)); - if (execvp(cmd_argv[0], const_cast(cmd_argv.data())) < 0) { - perror("execv"); - return 1; - } + TRY(Core::System::exec(cmd_parts[0], cmd_parts, Core::System::SearchInPath::Yes)); return 0; }