aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.posix/execlp.ccm
blob: ab3737c6fa82a777aabf2a262f6b58e1993ef3a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// This source code is released into the public domain.
module;

#include <expected>
#include <format>
#include <string>

export module nihil.posix:execlp;

import nihil.error;
import :argv;
import :execvp;

namespace nihil {

// execlp: equivalent to execvp, except the arguments are passed as a
// variadic pack of string-like objects.
export [[nodiscard]] auto
execlp(std::string_view file, auto &&...args) -> std::expected<execv, error>
{
	return execvp(file, argv({std::string_view(args)...}));
}

} // namespace nihil