diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt index 7e7087a940..3f62f9860d 100644 --- a/Userland/Utilities/CMakeLists.txt +++ b/Userland/Utilities/CMakeLists.txt @@ -162,6 +162,7 @@ target_link_libraries(cpp-parser LibCpp LibGUI) target_link_libraries(cpp-preprocessor LibCpp LibGUI) target_link_libraries(w LibMain) target_link_libraries(wasm LibWasm LibLine) +target_link_libraries(which LibMain) target_link_libraries(whoami LibMain) target_link_libraries(watch LibMain) target_link_libraries(wsctl LibGUI LibMain) diff --git a/Userland/Utilities/which.cpp b/Userland/Utilities/which.cpp index cf6fa72734..42183261f8 100644 --- a/Userland/Utilities/which.cpp +++ b/Userland/Utilities/which.cpp @@ -6,21 +6,19 @@ #include #include +#include #include #include -int main(int argc, char** argv) +ErrorOr serenity_main(Main::Arguments arguments) { - if (pledge("stdio rpath", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(Core::System::pledge("stdio rpath")); const char* filename = nullptr; Core::ArgsParser args_parser; args_parser.add_positional_argument(filename, "Name of executable", "executable"); - args_parser.parse(argc, argv); + args_parser.parse(arguments); auto fullpath = Core::find_executable_in_path(filename); if (fullpath.is_null()) {