aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.posix/execlp.ccm
blob: d0d88d57fc1d3b96134c3133af41f3c2ffd79dff (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
25
26
27
28
29
30
/*
 * This source code is released into the public domain.
 */

module;

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

export module nihil.posix:execlp;

import nihil.error;
import :exec;
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<base_executor_type, error>
{
	return execvp(file, argv({std::string_view(args)...}));
}

} // namespace nihil