// This source code is released into the public domain. module; #include #include #include #include export module nihil.posix:execvp; import nihil.error; import nihil.monad; import :argv; import :execv; import :find_in_path; namespace nihil { // execvp: equivalent to execv, except the command is passed as // a filename instead of a file descriptor. If the filename is not // an absolute path, it will be searched for in $PATH. export [[nodiscard]] auto execvp(std::string_view file, argv &&argv) -> std::expected { auto filename = co_await find_in_path(file); co_return execv(std::move(filename), std::move(argv)); } } // namespace nihil