// This source code is released into the public domain. export module nihil.posix:execvp; import nihil.std; import nihil.core; import nihil.error; import nihil.util; import :argv; import :execv; import :find_in_path; import :open_in_path; namespace nihil { // execvp: equivalent to execv, except the command will be searched for in $PATH. export [[nodiscard]] auto execvp(std::filesystem::path const &file, argv &&args) -> std::expected { if constexpr (features::fexecve) co_return execv(co_await open_in_path(file), std::move(args)); else co_return execv(co_await find_in_path(file), std::move(args)); } } // namespace nihil